Go to file
Emilio Cobos Álvarez 7abf375622
Minor version bump.
2017-05-27 02:28:58 +02:00
.github Fix issue template typo 2017-05-12 00:36:45 -07:00
bindgen-integration Allow asserting expectations across different libclang versions 2017-05-25 09:19:19 -07:00
book Add the bindgen Users Guide 2017-04-26 18:05:24 -04:00
ci Run tests with RUST_BACKTRACE=1 2017-05-18 13:00:09 -07:00
src ir: Don't panic when finding an unknown calling convention until code generation. 2017-05-26 11:57:29 +02:00
tests Allow asserting expectations across different libclang versions 2017-05-25 09:19:19 -07:00
.gitattributes Add a Stylo bindings sanity test 2017-04-12 10:21:19 -07:00
.gitignore Fix .gitignore and extra crates' Cargo.lock files 2017-01-26 16:27:55 -08:00
.travis.yml Allow asserting expectations across different libclang versions 2017-05-25 09:19:19 -07:00
build.rs build: Don't always expect a tests/headers directory. 2017-04-17 15:30:55 +02:00
Cargo.lock Minor version bump. 2017-05-27 02:28:58 +02:00
Cargo.toml Minor version bump. 2017-05-27 02:28:58 +02:00
CONTRIBUTING.md Allow asserting expectations across different libclang versions 2017-05-25 09:19:19 -07:00
example-graphviz-ir.png Update the example graphviz image 2017-02-17 17:45:49 -08:00
LICENSE fix build and add license 2013-08-05 10:43:15 +08:00
README.md Add the bindgen Users Guide 2017-04-26 18:05:24 -04:00
rustfmt.toml Manual fixups, some of them pretty lame, and don't let rustfmt rewrap comments. 2016-11-01 17:15:18 +01:00

bindgen

bindgen automatically generates Rust FFI bindings to C and C++ libraries.

For example, given the C header cool.h:

typedef struct CoolStruct {
    int x;
    int y;
} CoolStruct;

void cool_function(int i, char c, CoolStruct* cs);

bindgen produces Rust FFI code allowing you to call into the cool library's functions and use its types:

/* automatically generated by rust-bindgen */

#[repr(C)]
pub struct CoolStruct {
    pub x: ::std::os::raw::c_int,
    pub y: ::std::os::raw::c_int,
}

extern "C" {
    pub fn cool_function(i: ::std::os::raw::c_int,
                         c: ::std::os::raw::c_char,
                         cs: *mut CoolStruct);
}

Users Guide

📚 Read the bindgen users guide here! 📚

API Reference

API reference documentation is on docs.rs

Contributing

See CONTRIBUTING.md for hacking on bindgen!