Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

with_language option in builder is not working as expected #902

Open
beqabeqa473 opened this issue Nov 22, 2023 · 1 comment
Open

with_language option in builder is not working as expected #902

beqabeqa473 opened this issue Nov 22, 2023 · 1 comment

Comments

@beqabeqa473
Copy link

beqabeqa473 commented Nov 22, 2023

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.

@emilio
Copy link
Collaborator

emilio commented Apr 15, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants