mozilla / cbindgen

A project for generating C bindings from Rust code
Mozilla Public License 2.0
2.43k stars 314 forks source link

Private enums and constants included in header file #1012

Open lukasvrenner opened 1 month ago

lukasvrenner commented 1 month ago

I have a bunch of repr(u8) or repr(u16) enums in my project. They are marked with pub, but aren't loaded with pub mod, only mod. Therefore, they're not part of the public API. For some of them (but not all!) cbindgen generates their definitions in the output header file, as well as a few locally public (but still private to the public API). Additionally, arbitrary unused headers are included (such as stdlib.h, stdarg.h, etc).

I have tried it using both the default config file found in the docs, as well as an empty config file, and both resulting in the dane weird quirk. Maybe I'm doing something wrong, but this seems like really strange default behavior.

Thank you for all of your hard work!