Skip to content

Instantly share code, notes, and snippets.

@retep998
Created August 15, 2016 23:24
Show Gist options
  • Save retep998/372e2e67f8a55a93a3e0f4d1a75ed1f6 to your computer and use it in GitHub Desktop.
Save retep998/372e2e67f8a55a93a3e0f4d1a75ed1f6 to your computer and use it in GitHub Desktop.
//Compiled as a static library bar.lib
int bunny = 273;
int rabbit() { return 273; }
//Compiled as both a dylib and an rlib so there is both foo.rlib and foo.dll
#[link(name = "bar", kind = "static")]
extern { pub static bunny: i32; }
//Compiled as a Rust executable meow.exe
extern crate foo;
fn main() {
println!("{:?}", foo::bunny);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment