-
Notifications
You must be signed in to change notification settings - Fork 745
#include <stdlib.h> makes bindgen generate hundreds of irrelevant definitions #1212
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
Comments
That is expected. You're supposed to be using the whitelisting / blacklisting bits which should leave out everything unneeded. In this case you'd call bindgen like |
When I make bindings for 3rd party code I don't know all the types. I'd rather allow/block by directory (e.g. everything from |
Because of documentation error (#1214) I thought whitelisting would be unusable, but with regex support the whitelist workflow is not too bad. It's just I didn't expect it to be necessary, and hoped for the default invocation to be smarter. |
Right, whitelisting by directory was considered and it's not fun. For easy cases it's fine, but given you can declare the same type in multiple places, and then not define it, it can be unclear which directory a type belongs to. |
@kornelski I'm trying to understand how you actually solved this problem. |
Ahh. Ok. Got it. Thanks for responding. |
Input C/C++ Header
Bindgen Invocation
on macOS High Sierra.
Actual Results
Expected Results
i.e. include of system headers should not cause any output, unless some type from the header is actually used. Then it should only pull definition of that type, rather than open floodgates to whatever the OS puts in there. Total blacklisting of all items from all system headers would be fine, too. I prefer to add them from the libc crate.
This is a problem, because:
it exposes definitions that are private to the OS. They're unstable and non-portable, and aren't supposed to be the part of an API that a
-sys
crate exposes.there's a lot of them. It's very time consuming and error prone to delete them to leave only relevant bits.
The text was updated successfully, but these errors were encountered: