commit | 7a5ae200e9d7d38a72cb0be11c9e9a6cfceeb839 | [log] [tgz] |
---|---|---|
author | Emilio Cobos Álvarez <emilio@crisal.io> | Fri Jan 18 23:37:55 2019 +0100 |
committer | GitHub <noreply@github.com> | Fri Jan 18 23:37:55 2019 +0100 |
tree | f8c6cfef724ca88949dff56da2f31b05cb65f122 | |
parent | 42bfc232d3de3600cfa070cc6dab13a45870dc90 [diff] | |
parent | 5c92043f2a1b42d52fc2468c2baf0c9cc597c1f8 [diff] |
Merge pull request #1495 from tromey/packed-only-vtable Fix layout with packed class that only has a vtable
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); }
📚 Read the bindgen
users guide here! 📚
API reference documentation is on docs.rs