rust-bindgen
rust-bindgen copied to clipboard
Automatically generates Rust FFI bindings to C (and some C++) libraries.
This is an experimental rebase of #1740 upon the current master, a1a00434ffc0b5d93ef108d8cc93fafb8c649d83. Most commits do not compile or pass tests, and many have been modified during the rebase. The current...
[`feature(core_ffi_c)`](https://github.com/rust-lang/rust/issues/94501) was stabilized (and possibly [`feature(c_size_t)`](https://github.com/rust-lang/rust/issues/88345) in the future), so we may want to extend `--use-core` to use them (gated on `--rust-target` or some other flag). In fact, it could...
### Input C/C++ Header ```c typedef enum VkResult { VK_SUCCESS = 0, VK_NOT_READY = 1, // ... } VkResult; ``` ### Bindgen Invocation ``` $ bindgen --no-prepend-enum-name --newtype-enum VkResult input.h...
This allows more easily setting arguments that may come from an OsString like a path from `pkg-config`
### Input C/C++ Header ```objc @interface A -(void)f:(int)arg1 as:(int)arg2; @end ``` ### Bindgen Invocation ``` $ bindgen objc_escape.m ``` ### Actual Results ```rust /* automatically generated by rust-bindgen 0.60.1 */...
libclang's API does not provide a straightforward way to check for this, and calling clang_getFieldDeclBitWidth is actively unsafe in this case. See https://github.com/llvm/llvm-project/issues/56644 We probably can't generate reasonable bindings for...
When using bindgen with an assertions-enabled libclang build, the following code fails an assertion. The assertion indicates either bindgen or the internals of libclang are requesting const eval of `sizeof(c)`...
I'm trying to generate bindings for apple frameworks. Tried multiple combinations. Here is an example: ``` bindgen /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Accounts.framework/Headers/Accounts.h -o bindings.rs -- -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/ ``` getting an error: ``` /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk//System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:492:1: error:...
I'm working on bindings of a C library (OpenUCX) where the majority, but not all, of function pointers used are never null (both typedefs and struct fields) - hence they...
### Input C/C++ Header ```C typedef const struct foo { void *bar; } *foo; ``` ### Bindgen Invocation ``` $ bindgen --no-layout-tests log.h > log.rs ``` ### Actual Results ```rust...