A native binding generator for the Rust language.
rust-bindgen was originally ported from clay's bindgen.
- Clang >= 3.5
$ cargo install bindgen
Bindgen will be dynamically linked to your default clang version. See
clang-sys if you
want to use an other version or do a static link build. The clang-sys feature
static can be activated via the bindgen feature clang_sys/static.
$ bindgen <header> [<bindgen options>] [-- <clang options>]
See --help for a list of the supported options.
bindgen!(header, options...)The use of this plugin requires the use of a nightly compiler.
Options:
| Option Name | Type | Default |
|---|---|---|
| link | str | |
| match | str | |
| builtins | bool | true |
| allow_unknown_types | bool | false |
| clang_args | str |
bindgen --link lua --builtins /usr/include/lua.h -o lua.rs
Cargo.toml
[dependencies]
bindgen = "*"
main.rs
#![feature(plugin)]
#![plugin(bindgen)]
mod lua_bindings {
bindgen!("/usr/include/lua.h", link="lua", builtins=true)
}