Add rust to go dynamic library example.
This commit is contained in:
13
rust-to-go-dynamic/build.rs
Normal file
13
rust-to-go-dynamic/build.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
use std::process::Command;
|
||||
|
||||
fn main() {
|
||||
println!(r"cargo:rustc-link-search=target/debug");
|
||||
let os = Command::new("uname")
|
||||
.output().unwrap();
|
||||
let ext = match String::from_utf8_lossy(os.stdout.as_slice()).into_owned().trim_end().as_ref() {
|
||||
"Darwin" => "dylib",
|
||||
_ => "so"
|
||||
};
|
||||
Command::new("go").args(&["build", "-o", &format!("target/debug/libdouble_input.{}", ext), "-buildmode=c-shared", "src/double.go"])
|
||||
.status().unwrap();
|
||||
}
|
||||
Reference in New Issue
Block a user