Automatically generates Rust FFI bindings to C (and some C++) libraries.
Clone or download
emilio Merge pull request #1508 from flowbish/function_ptr_return_type
Add an alternate path determining the arguments for a function.
Latest commit 49b7424 Feb 3, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Update broken links: Rust-lang-nursery => Rust-lang (#1447) Nov 24, 2018
bindgen-integration While at it, gcc -> cc in the integration tests. Nov 30, 2018
book Fix book links when viewing via Github Jan 18, 2019
ci Update mdbook. Sep 8, 2018
csmith-fuzzing fuzzing: Add a --release flag to the predicate script. Feb 3, 2019
releases Add a changelog Nov 1, 2017
src Rework the way that argument types and names are found from function … Feb 3, 2019
tests Rework the way that argument types and names are found from function … Feb 3, 2019
.gitattributes Always check out test headers and expectations as LF Sep 23, 2017
.gitignore Fix gitignore so ripgrep works Jan 25, 2019
.travis.yml Adjust .travis.yml to only use maj-min versions. Apr 3, 2018
CHANGELOG.md Bump version and update changelog. Jan 19, 2019
CONTRIBUTING.md Add `BINDGEN_OVERWRITE_EXPECTED` for recording tests Jan 17, 2019
Cargo.lock fuzzing: Add a --release flag to the predicate script. Feb 3, 2019
Cargo.toml Version bump. Jan 29, 2019
LICENSE Regenerates the BSD3 License so GitHub recognises it Jul 5, 2018
README.md Update Readme Nov 24, 2018
appveyor.yml Now that we have stuff that depends on libclang-5 we need to do this. Apr 3, 2018
build.rs Add `BINDGEN_OVERWRITE_EXPECTED` for recording tests Jan 17, 2019
example-graphviz-ir.png Update the example graphviz image Feb 18, 2017
rustfmt.toml Remove unstable rustfmt-nightly features Dec 4, 2017

README.md

bindgen

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

For example, given the C header doggo.h:

typedef struct Doggo {
    int many;
    char wow;
} Doggo;

void eleven_out_of_ten_majestic_af(Doggo* pupper);

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

/* automatically generated by rust-bindgen */

#[repr(C)]
pub struct Doggo {
    pub many: ::std::os::raw::c_int,
    pub wow: ::std::os::raw::c_char,
}

extern "C" {
    pub fn eleven_out_of_ten_majestic_af(pupper: *mut Doggo);
}

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!