cbindgen
cbindgen copied to clipboard
with_language option in builder is not working as expected
Hello.
I am trying to generate a C header using cbindgen, using build.rs builder.
here is a code
use std::env;
fn main() {
println!("cargo:rerun-if-changed=./src/lib.rs");
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
cbindgen::Builder::new()
.with_crate(crate_dir)
.with_include_version(true)
.with_documentation(false)
.with_parse_deps(true)
.with_parse_include(&["ffi-support", "opaque-pointer"])
.with_cpp_compat(true)
// .with_language(cbindgen::Language::C)
.generate()
.expect("Unable to generate bindings")
.write_to_file("header.h");
}
It still generates C++ header file. Used crate is 0.26.0
Is something wrong with builder itself or maybe i am doing something wrong?
Thanks.
Sorry for the lag replying to this. You're using with_cpp_compat(true) which generates C++-compatible code, is that not what's going on?