Commit 2bf0ca27 authored by Ryan Hunt's avatar Ryan Hunt
Browse files

Update the README for build script instructions

parent e76b2570
......@@ -11,8 +11,31 @@ This project can be used to generate C bindings for Rust code. It is currently b
## Use
### Command line
`cbindgen crate/ crate/bindings.h`
See `cbindgen --help` for more options.
### `build.rs`
`cbindgen` can also be used in build scripts. How this fits into compiling the native code depends on your project.
Here's an example build.rs script:
```rust
extern crate cbindgen;
use cbindgen::{Config, Library};
fn main() {
let config = Config::default();
Library::load("../build-script", &config)
.build(&config).unwrap()
.write_to_file(&config, "bindings.h");
}
```
## Examples
See `examples/` for some examples of rust source that can be handled.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment