Add rust to go dynamic library example.

This commit is contained in:
Andrey Voronkov
2019-08-16 22:06:19 +02:00
parent 12f8d239f8
commit f09149f4f7
4 changed files with 45 additions and 0 deletions

View 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();
}