Skip to content

cbindgen emits constants in spite of no-export and/or ignore annotations  #947

@scovich

Description

@scovich

For the following rust code:

// cbindgen:ignore
// cbindgen:no-export
pub struct Foo;

// cbindgen:ignore
// cbindgen:no-export
impl Foo {
    // cbindgen:ignore
    // cbindgen:no-export
    pub const BAR: i64 = 42;
}

cbindgen still emits the following header code:

constexpr static const int64_t Foo_BAR = 42;

I haven't found any combination of annotations that can suppress it, even tho the docs suggest it should work?

For ignore:

You can manually ignore other stuff with the ignore annotation attribute

For no-export:

cbindgen will usually emit all items it finds, as instructed by the parse and export config sections. This annotation will make cbindgen skip this item from the output, while still being aware of it.

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