Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rust example #20

Open
0xjjoyy opened this issue Jun 6, 2020 · 2 comments
Open

Rust example #20

0xjjoyy opened this issue Jun 6, 2020 · 2 comments

Comments

@0xjjoyy
Copy link

0xjjoyy commented Jun 6, 2020

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.");
}
@0xjjoyy
Copy link
Author

0xjjoyy commented Jun 8, 2020

@vladimirvivien
Copy link
Owner

Hi can you send over a PR for this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants