Skip to content
Automatically generates Rust FFI bindings to C (and some C++) libraries.
Branch: master
Clone or download
Latest commit 5b2f344 Mar 26, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
bindgen-integration integration: Fix integration tests with rust 1.33. Mar 4, 2019
book Small fix in tutorial Feb 5, 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 options: Add an option to opt-out of include path detection. Mar 26, 2019
tests ir: Whitelist items that don't generate code to improve derive behavior. Mar 25, 2019
.gitattributes
.gitignore
.travis.yml
CHANGELOG.md
CONTRIBUTING.md
Cargo.lock
Cargo.toml
LICENSE Regenerates the BSD3 License so GitHub recognises it Jul 5, 2018
README.md
appveyor.yml
build.rs
example-graphviz-ir.png
rustfmt.toml

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!

You can’t perform that action at this time.