$ cargo run -- --lang c foo.rs
thread 'main' panicked at src/bindgen/mangle.rs:132:17:
not implemented: Unable to mangle generic parameter Array(Primitive(Integer { zeroable: true, signed: false, kind: B8 }), Value("2")) for 'StructA'
Even if you don't want to generate bindings for StructA or StructB so you use exclude = ["StructA", "StructB"], cbindgen still panics since the monomorphs are initialized before the exclusion happens.
It would be nice if cbindgen ignored StructA and StructB instead of panicking. As far as I know, the only solution is to split the file into two files, and only run cbindgen on the file that does not contain StructA and StructB.
If you try to generate bindings for
StructC
in the following file, cbindgen will panic:Even if you don't want to generate bindings for
StructA
orStructB
so you useexclude = ["StructA", "StructB"]
, cbindgen still panics since the monomorphs are initialized before the exclusion happens.https://github.com/mozilla/cbindgen/blob/6bfc2176187a6fc6fba6315323b0296112330294/src/bindgen/library.rs#L69-L72
It would be nice if cbindgen ignored
StructA
andStructB
instead of panicking. As far as I know, the only solution is to split the file into two files, and only run cbindgen on the file that does not containStructA
andStructB
.