crabtw/rust-bindgen — pull request #81 by ebarnard (2014-05-16 20:57:05+00:00)
Title: Add a bindgen! macro

NOT READY TO MERGE
___________
The bindgen! macro expands to a private module in whichever file it is invoked in i.e.

```rust
mod whatever_mod_name_you_chose {
// Attributes and bindings go here
}
```

At the moment it still requires the caller add the following to their crate root.
```rust
extern crate libc
#![feature(globs)]
```

The syntax is fairly flexible. Arguments can come in any order and you can mix and match : and =. The only restriction is the module name must be the first argument.

Here's an example invocation (using all the options):
```rust
bindgen!(mod_name, header="header.h", "another_header.h", allow_bitfields: true,
match="file.h", abi="C", allow_unknown_types=false, emit_builtins: true,
clang_args="-I /usr/local/include")
```

____________

TODO:
- Allow passing a header file as a string
- Option for getting link names from pkgconfig

I've tried it on a few of my libraries that were using bindgen and they all work fine but it would be good to have some other testers.
Also what does everyone think of the invocation syntax (the more I think about it the more allowing both : and = seems weird).