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.
tree: 83f2d370b530749c21eb9e16d6866ae4237dd0ee
  1. .github/
  2. bindgen-integration/
  3. book/
  4. ci/
  5. src/
  6. tests/
  7. .gitattributes
  8. .gitignore
  9. .travis.yml
  10. build.rs
  11. Cargo.lock
  12. Cargo.toml
  13. CONTRIBUTING.md
  14. example-graphviz-ir.png
  15. LICENSE
  16. README.md
  17. rustfmt.toml
README.md

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);
}

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!