Skip to content

Rust example #20

@0xjjoyy

Description

@0xjjoyy

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.");
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions