cbindgen
cbindgen copied to clipboard
A project for generating C bindings from Rust code
`lib.rs`: ``` //! This comment will not be exported. ```
A library I'm currently binding to Rust ([liboscore](https://gitlab.com/oscore/liboscore)) has something of a compile-time module system (think back-end, not plug-in; there's only one back-end at a compile time) that works like...
When using the export prefix option, it is added twice to the "enum body" structs: PrefixEnum_PrefixCase_Body; The second prefix is not necessary.
There are a few settings in cbindgen that generate helper C++ methods for working with tagged enums, but they all seem tied to derive helper methods: - derive_helper_methods: false -...
This Rust code: ```rust #[repr(C, u8)] pub enum S { Leaf(i32), Parent(Box), } #[no_mangle] pub extern "C" fn root(f: &S) {} ``` only generates a forward declaration of `S`, because...
I'm trying to export some Rust functions as a DLL to be used in a larger application, but instead of the usual `extern "C"` calling convention, I'm using `stdcall`. With...
I wonder if it is possible to add an annotation for functions to customize the return type of a function, something like this: ```rust /// cbindgen:return-type=Foobar pub extern "C" fn...
Sample Input: ```rust #[repr(C)] pub struct Matrix { pub data: [f32; 20], } #[repr(C)] pub enum Data { Something, Matrix(Matrix), } #[no_mangle] pub unsafe extern "C" fn new_data() -> *mut...
Spun off from #431. Since https://github.com/rust-lang/rust/pull/61229, aligned enums have a stable representation and thus we should represent them correctly when generating non-opaque versions.
Split off from #431 Right now, we don't generate structs for `#[repr(packed(n))]` structures because it appears that there is a fair amount of difficulty generating the correct field alignments due...