#bindings #ffi #code-generation

bin bindgen

Automatically generates Rust FFI bindings to C and C++ libraries

55 releases (23 breaking)

new 0.38.0 Aug 15, 2018
0.37.4 Jul 1, 2018
0.37.0 May 18, 2018
0.35.0 Mar 25, 2018
0.0.2 Nov 21, 2014

#4 in FFI

Download history 2474/week @ 2018-05-26 2498/week @ 2018-06-02 2971/week @ 2018-06-09 3203/week @ 2018-06-16 3741/week @ 2018-06-23 3367/week @ 2018-06-30 4212/week @ 2018-07-07 3695/week @ 2018-07-14 3376/week @ 2018-07-21 3213/week @ 2018-07-28 3047/week @ 2018-08-04 3148/week @ 2018-08-11 3705/week @ 2018-08-18

14,216 downloads per month

bindgen

impl period has been started! Join us at Gitter.im.

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!

BSD-3-Clause license

Dependencies

  • build build.rs
  • dev diff 0.1
  • dev shlex 0.1

Reverse deps