go-cshared-examples
go-cshared-examples copied to clipboard
Rust example
Hi,
It would be helpful if there was a Rust example.
I tried though wasn't able to get the linking flags to compile.
Cargo.toml
[package]
name = "client_rust"
version = "0.1.0"
authors = ["example"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
libc = "0.2"
src/main.rs
use libc::c_long;
#[link(name = "awesome", kind="dylib")]
extern {
fn Add(num1: c_long, num2: c_long) -> ();
}
fn main() {
unsafe { Add(5,5); }
println!("Ran the unsafe code.");
}
Examples https://github.com/0xjjoyy/go-cshared-examples
Hi can you send over a PR for this ?