commit | 765671df1a6b93fccf7460043be865055de7ceb2 | [log] [tgz] |
---|---|---|
author | bors-servo <lbergstrom+bors@mozilla.com> | Wed May 03 14:48:02 2017 -0500 |
committer | GitHub <noreply@github.com> | Wed May 03 14:48:02 2017 -0500 |
tree | 83f2d370b530749c21eb9e16d6866ae4237dd0ee | |
parent | 8e9b3884961802a8c5c102ecfff06419e9695199 [diff] | |
parent | 335e5c726608e73af062315bcd76cf639e27330c [diff] |
Auto merge of #673 - scoopr:objc, r=emilio objc: Fixes to properly parse most of Foundation I had half of these just lying around in my commit queue for a while, having problems with the template param thing. Incidentally, either some other fixes made it work, or I had accidentally built against clang 4.0, which I guess doesn't work with the current approach. With these I'm able to parse and generate code for Foundation.framework, with regex ^NS.* (and skipping that one id redefine). Also needed --no-doc-comments, that I guess generated comment for an enum in the wrong place, didn't look at that.
bindgen
bindgen
automatically generates Rust FFI bindings to C and C++ libraries.
For example, given the C header cool.h
:
typedef struct CoolStruct { int x; int y; } CoolStruct; void cool_function(int i, char c, CoolStruct* cs);
bindgen
produces Rust FFI code allowing you to call into the cool
library's functions and use its types:
/* automatically generated by rust-bindgen */ #[repr(C)] pub struct CoolStruct { pub x: ::std::os::raw::c_int, pub y: ::std::os::raw::c_int, } extern "C" { pub fn cool_function(i: ::std::os::raw::c_int, c: ::std::os::raw::c_char, cs: *mut CoolStruct); }
📚 Read the bindgen
users guide here! 📚
API reference documentation is on docs.rs