diff options
-rw-r--r-- | README.md (renamed from README.txt) | 48 |
1 files changed, 31 insertions, 17 deletions
@@ -1,34 +1,36 @@ -A binding generator for the rust language. -It is ported from clay's bindgen[1]. +rust-bindgen +============ -[1] https://github.com/jckarter/clay/blob/master/tools/bindgen.clay +A binding generator for the rust language. +It is ported from [clay's bindgen][]. Requirements ------------ * clang 3.4 and up -Note: The libclang.so has to be statically linked with LLVM - or you will encounter https://github.com/crabtw/rust-bindgen/issues/89 - You can also use LD_PRELOAD=/path/to/libclang.so to workaround the problem +Note: The libclang.so has to be statically linked with LLVM or you will +encounter [issue 89][]. You can also use LD_PRELOAD=/path/to/libclang.so to +workaround the problem. Building -------- $ cargo build -Note: If you want to use Apple's version of libclang on OS X, you will need -to add this to both commands: +Note: This links with Apple's version of libclang on OS X by default. This can be changed by setting the LIBCLANG_PATH environment variable. - -C link-args="-L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/" +If you are running the command line tool you will also need to append this +path to your DYLD_LIBRARY_PATH environment variable, which you might already have set if you have installed the Rust compiler outside of standard /usr/local path. -You will also need to append this path to your DYLD_LIBRARY_PATH environment -variable, which you might already have set if you have installed the Rust -compiler outside of standard /usr/local path. +The default path on OS X is: + + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/ Command Line Usage ------------------ +``` Usage: ./bindgen [options] input.h Options: -h or --help Display help message @@ -62,10 +64,12 @@ Options: slonglong Options other than stated above are passed to clang +``` Macro Usage ----------- +``` Usage: bindgen!([headers], [named options]) Options: @@ -80,22 +84,29 @@ Options: allow_bitfields bool false allow_unknown_types bool false clang_args string - - See "Command Line Usage" section for option descriptions +``` +See "Command Line Usage" section for option descriptions Examples -------- -Generate MySQL client bindings +###Generate MySQL client bindings bindgen -l mysql -match mysql.h -o mysql.rs /usr/include/mysql/mysql.h -or +*or* echo '#include <mysql.h>' > gen.h bindgen `mysql_config --cflags` -l mysql -match mysql.h -o mysql.rs gen.h -or +*or* + +Cargo.toml + + [dependencies.rust-bindgen] + git = "https://github.com/crabtw/rust-bindgen.git" + +main.rs #![feature(phase)] #[phase(plugin)] extern crate bindgen; @@ -109,3 +120,6 @@ TODO ---- * bit field + +[clay's bindgen]: https://github.com/jckarter/clay/blob/master/tools/bindgen.clay +[issue 89]: https://github.com/crabtw/rust-bindgen/issues/89
\ No newline at end of file |