Hi dear all,
I'm trying the following code
mylib.rs
pub fn hello() { println!("hello Rust"); }
compile it with following command
rustc mylib.rs --crate-type rlib
got a libmylib.rlib
, write a test
main.rs
extern crate mylib; fn main() { mylib::hello(); }
comiple this file with following command line
rustc main.rs -L .
it works. then I deleted libmylib.rlib
and compile mylib.rs
to a dylib
rustc mylib.rs --crate-type dylib
got mylib.dll
and mylib.dll.lib
, this time the following command failed
rustc main.rs -L .
So how to link to a Rust dynlib ? Many thanks!!!