commit | 93dc6dbe6931f5d8f2c7b9c9fd6cb6923eaea7be | [log] [tgz] |
---|---|---|
author | Chih-Hung Hsieh <chh@google.com> | Mon Jun 22 21:39:15 2020 -0700 |
committer | Chih-Hung Hsieh <chh@google.com> | Thu Jun 25 12:40:08 2020 -0700 |
tree | 2adea7775c05a0ee2ee40ed1d52fe8a1479509e9 | |
parent | 13ac27fde01dfa77491d90751dd35710fda93485 [diff] |
Add bindgen.sh for genrule modules * bindgen required environment variables are set in bindgen.sh, which also adds dependencies of those tool paths into the output dependent file. Bug: 157666974 Bug: 152884384 Test: make Change-Id: I4164492466b9c0e1e7297307470ac985a63382e6
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! 📚
The minimum supported Rust version is 1.34.
No MSRV bump policy has been established yet, so MSRV may increase in any release.
API reference documentation is on docs.rs