Skip to content

Unable to blocklist #2421

@ccleve

Description

@ccleve

I'm attempting to create a minimal bindings.rs. I have a C header file that has many transitive includes, and I'd like to omit them all. I only want bindings that I have explicitly included.

In 0.61.0, this code worked fine:

    let bindings = bindgen::Builder::default()
        .header("src/cfuncs/myheader.h")
        .blocklist_type("*") // block everything not explicitly added
        .allowlist_function("rdb_.*")
        .allowlist_var("RDB_.*")
        .allowlist_type("rdb_.*")
        .parse_callbacks(Box::new(bindgen::CargoCallbacks))
        .generate()
        .expect("Unable to generate bindings");

I upgraded to 0.64.0 and it ignored my blocklist. It started pulling in all of the transitive dependencies.

I added a few lines:

    let bindings = bindgen::Builder::default()
        .header("src/cfuncs/myheader.h")
        .blocklist_type("*") // block everything not explicitly added

        // these lines added
        .blocklist_file("*")
        .blocklist_function("*")
        .blocklist_item("*")
        .opaque_type("*")

        .allowlist_function("rdb_.*")
        .allowlist_var("RDB_.*")
        .allowlist_type("rdb_.*")
        .parse_callbacks(Box::new(bindgen::CargoCallbacks))
        .generate()
        .expect("Unable to generate bindings");

but this command still pulls in all of the transitives.

How do I get it to behave like 0.61.0?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions