Skip to content

Instantly share code, notes, and snippets.

@yushulx
Created October 12, 2018 06:55
Show Gist options
  • Save yushulx/ebec15324dfd8c257c33cb8bfcd13d70 to your computer and use it in GitHub Desktop.
Save yushulx/ebec15324dfd8c257c33cb8bfcd13d70 to your computer and use it in GitHub Desktop.
extern crate bindgen;
fn main() {
// Generates Rust FFI bindings.
let bindings = bindgen::Builder::default()
// The input header we would like to generate
// bindings for.
.header("src/bridge.h")
// Finish the builder and generate the bindings.
.generate()
// Unwrap the Result and panic on failure.
.expect("Unable to generate bindings");
bindings
.write_to_file("src/bridge.rs")
.expect("Couldn't write bindings!");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment