Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
android/bindgen_cmd/ | 23-Nov-2023 | - | 81 | 46 | ||
csmith-fuzzing/ | 23-Nov-2023 | - | 66 | 46 | ||
out/ | 23-Nov-2023 | - | 2 | 1 | ||
src/ | 23-Nov-2023 | - | 27,500 | 19,827 | ||
.cargo_vcs_info.json | D | 23-Nov-2023 | 74 | 6 | 5 | |
Android.bp | D | 23-Nov-2023 | 3.7 KiB | 138 | 131 | |
Cargo.lock | D | 23-Nov-2023 | 9 KiB | 352 | 309 | |
Cargo.toml | D | 23-Nov-2023 | 2.7 KiB | 114 | 93 | |
Cargo.toml.orig | D | 23-Nov-2023 | 2.3 KiB | 89 | 78 | |
LICENSE | D | 23-Nov-2023 | 1.5 KiB | 30 | 23 | |
METADATA | D | 23-Nov-2023 | 403 | 20 | 19 | |
MODULE_LICENSE_BSD_LIKE | D | 23-Nov-2023 | 0 | |||
OWNERS | D | 23-Nov-2023 | 40 | 2 | 1 | |
README.md | D | 23-Nov-2023 | 2.5 KiB | 80 | 53 | |
TEST_MAPPING | D | 23-Nov-2023 | 257 | 15 | 14 | |
build.rs | D | 23-Nov-2023 | 2.5 KiB | 83 | 66 | |
post_update.sh | D | 23-Nov-2023 | 116 | 10 | 3 |
README.md
1[![crates.io](https://img.shields.io/crates/v/bindgen.svg)](https://crates.io/crates/bindgen) 2[![docs.rs](https://docs.rs/bindgen/badge.svg)](https://docs.rs/bindgen/) 3 4# `bindgen` 5 6**`bindgen` automatically generates Rust FFI bindings to C (and some C++) libraries.** 7 8For example, given the C header `doggo.h`: 9 10```c 11typedef struct Doggo { 12 int many; 13 char wow; 14} Doggo; 15 16void eleven_out_of_ten_majestic_af(Doggo* pupper); 17``` 18 19`bindgen` produces Rust FFI code allowing you to call into the `doggo` library's 20functions and use its types: 21 22```rust 23/* automatically generated by rust-bindgen 0.99.9 */ 24 25#[repr(C)] 26pub struct Doggo { 27 pub many: ::std::os::raw::c_int, 28 pub wow: ::std::os::raw::c_char, 29} 30 31extern "C" { 32 pub fn eleven_out_of_ten_majestic_af(pupper: *mut Doggo); 33} 34``` 35 36## Users Guide 37 38[ Read the `bindgen` users guide here! ](https://rust-lang.github.io/rust-bindgen) 39 40## MSRV 41 42The minimum supported Rust version is **1.40**. 43 44No MSRV bump policy has been established yet, so MSRV may increase in any release. 45 46## API Reference 47 48[API reference documentation is on docs.rs](https://docs.rs/bindgen) 49 50## Environment Variables 51 52In addition to the [library API](https://docs.rs/bindgen) and [executable command-line API][bindgen-cmdline], 53`bindgen` can be controlled through environment variables. 54 55End-users should set these environment variables to modify `bindgen`'s behavior without modifying the source code of direct consumers of `bindgen`. 56 57- `BINDGEN_EXTRA_CLANG_ARGS`: extra arguments to pass to `clang` 58 - Arguments are whitespace-separated 59 - Use shell-style quoting to pass through whitespace 60 - Examples: 61 - Specify alternate sysroot: `--sysroot=/path/to/sysroot` 62 - Add include search path with spaces: `-I"/path/with spaces"` 63 64Additionally, `bindgen` uses `libclang` to parse C and C++ header files. 65To modify how `bindgen` searches for `libclang`, see the [`clang-sys` documentation][clang-sys-env]. 66For more details on how `bindgen` uses `libclang`, see the [`bindgen` users guide][bindgen-book-clang]. 67 68## Releases 69 70We don't follow a specific release calendar, but if you need a release please 71file an issue requesting that (ping `@emilio` for increased effectiveness). 72 73## Contributing 74 75[See `CONTRIBUTING.md` for hacking on `bindgen`!](./CONTRIBUTING.md) 76 77[bindgen-cmdline]: https://rust-lang.github.io/rust-bindgen/command-line-usage.html 78[clang-sys-env]: https://github.com/KyleMayes/clang-sys#environment-variables 79[bindgen-book-clang]: https://rust-lang.github.io/rust-bindgen/requirements.html#clang 80