rust-bindgen
rust-bindgen copied to clipboard
Automatically generates Rust FFI bindings to C (and some C++) libraries.
We have `--translate-enum-integer-types`, but no equivalent for anything else
* Fixes #2378. * Fixes #2991.
This would be sort of a pain, but it's the only way we see us generating more correct code for all the partial template specialization madness we're going through with...
### Input C/C++ Header ```C++ struct _GumChainedPtr64Rebase { guint64 target : 36, high8 : 8, reserved : 7, next : 12, bind : 1; }; ``` ### Bindgen Invocation ```Rust...
### Input C/C++ Header ```C++ //union forward_declared;
Bindgen fails with hard-to-debug erros (see example) when invoked cargo's target riscv32imac-unknown-none-elf. I can pass a `--target=riscv32` flag explicitly passed in via a CFLAG -- but [the code for that](https://github.com/rust-lang/rust-bindgen/blob/3bdfcf7992041acbc7a9278e82d6def8cbd88952/src/ir/context.rs#L540)...
This supersedes https://github.com/rust-lang/rust-bindgen/pull/2268 which aimed to support casts in macros. The [`cmacro`](https://github.com/reitermarkus/cmacro-rs) crate I developed over the last months allows parsing casts in variable-like macros and even more complex macros,...
### Input C/C++ Header ```objc @interface MyClass @end ``` ### Bindgen Invocation ``` $ bindgen input.h -- -x objective-c ``` ### Actual Results ```rust ... #[repr(transparent)] #[derive(Debug, Copy, Clone)] pub...
### Input C/C++ Header ```C++ typedef struct { int field; } strct; typedef strct typ[1]; void function(const typ a, const strct *b); ``` ### Actual Results ```rust pub type typ...
Bindgen often is deployed to build code using libclang's dynamic library, set by `LIBCLANG_PATH`. However, in bindgen, there is this code: https://github.com/rust-lang/rust-bindgen/blob/4f9fa49ca907b831fdc3aecdfaec36b16d03c8d8/bindgen/lib.rs#L824-L830 This starts with the following check: https://github.com/KyleMayes/clang-sys/blob/b7992e864eaa2c8cb5c014a52074b962f257e29b/src/support.rs#L59-L65 Unfortunately,...