Go to file
Emilio Cobos Álvarez 96304f90a4
Breaking version bump.
2017-07-10 23:16:59 +02:00
.github Minimal test cases don't have #includes 2017-07-05 15:00:07 -07:00
bindgen-integration Auto merge of #763 - rigelk:757-unstable-defaults, r=emilio,fitzgen 2017-06-19 15:45:08 -07:00
book Drop llvm@3.9 versioning for homebrew. 2017-06-29 13:27:31 -07:00
ci Disallow system header file includes in our test suite 2017-07-06 10:03:08 -07:00
src codegen: Make comments indentation-aware. 2017-07-10 23:16:59 +02:00
tests codegen: Make comments indentation-aware. 2017-07-10 23:16:59 +02:00
.gitattributes Add a Stylo bindings sanity test 2017-04-12 10:21:19 -07:00
.gitignore Ignore output from test script 2017-06-17 15:34:05 -07:00
.travis.yml Allow asserting expectations across different libclang versions 2017-05-25 09:19:19 -07:00
build.rs Add a way to get the target triple, and do our best guess at it until we have proper clang support. 2017-06-01 14:21:11 +02:00
Cargo.lock Breaking version bump. 2017-07-10 23:16:59 +02:00
Cargo.toml Breaking version bump. 2017-07-10 23:16:59 +02:00
CONTRIBUTING.md Add some information about PRs and review to CONTRIBUTING.md 2017-06-14 16:13:42 -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!