rust-bindgen
rust-bindgen copied to clipboard
Automatically generates Rust FFI bindings to C (and some C++) libraries.
When generating bindings for many headers, `try_ensure_fallback_translation_unit` fails because `pch` is constructed with a excessively long filename. Replacing it just by `"precompile.h.pch"` fixes this.
`Builder` methods [`allowlist_*`](https://docs.rs/bindgen/latest/bindgen/struct.Builder.html#method.allowlist_type) and [`blocklist_*`](https://docs.rs/bindgen/latest/bindgen/struct.Builder.html#method.blocklist_type) do not support case-insensitive regex patterns like `((?i).*foo)` (note the **`(?i)`** modifier). If you try to use them: ```rust let bindings = bindgen::Builder::default() .header("myheader.h") .allowlist_file("(?i).*foo")...
When using `impl_debug(true)` together with `default_alias_style(bindgen::AliasVariation::NewTypeDeref)` and generating bindings to a C union which has a typedef alias, the generated Rust code has a `Debug` implementation for the C union...
As per https://github.com/rust-lang/rust-bindgen/issues/3098 and https://github.com/rust-lang/rust-bindgen/issues/3200, currently clang doesn't provide sufficient type information to tell if a macro generated integer is a u64, a u32, or anything else. As such and...
It would be great if the Rust code generated by `bindgen` would keep the [number bases](https://en.wikipedia.org/wiki/Radix) of the integer literals in the input C and C++ code. After all, the...
### Problem Bindgen supports different enum representations which are either marked `repr(transparent)` or `repr($ty)` where `$ty` is the representation used for the enum (an integer type or an alias for...
The radices of integer literals in the input code, including both C and C++, are retained on a best-effort basis in the generated bindings. - The radix of a C/C++...
Swift imports C apis while taking into account [clang nullability attributes](https://clang.llvm.org/docs/AttributeReference.html#nullability-attributes): `_Nullable` & `_Nonnull` which results in `Optional
Some crates have the ability to decide whether the shared object file will be `dlopen`ed or linked into the executable. For example, `ash-rs` exposes `Entry::linked()` and `Entry::load()` depending whether features...
**ISSUE** bindgen fails to parse LLVM 21's libc++ template metaprogramming, specifically `std::basic_string_view` and `std::invoke_result_t` templates, generating invalid Rust code. **EXPECTED BEHAVIOR** bindgen should handle LLVM 21's C++ standard library templates...