- Add
build = "src/build.rs"inCargo.toml(otherwise cargo sometimes fails to pick it up and I don't know why) #[link(name = "hello", kind = "dylib")](or another kind; in this case a dylib)cargo:rustc-link-searchflag inbuild.rsfile- Set environment variables correctly (Linux:
LD_LIBRARY_PATH, Mac:DYLD_LIBRARY_PATH)
build_and_run bash script sets enviroment variables for you; you may want to take a look at it.