-
Notifications
You must be signed in to change notification settings - Fork 148
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
"Alias" style typedefs are being omitted in bindgen for not having a definition, but then generating bad bindings #509
Comments
By default ClangSharp resolves down to the root type. This allows things like operators to work, avoids ABI issues, perf issues, etc. There are command line switches such as It is expected that users override such typedefs where that is necessary, with ClangSharp handling only a few special cases like |
This makes sense and I'll definitely try some of those flags, but also it seems like maybe there is a bug where if a typedef "hides" an underlying "normal" C++ type like FILE*, ClangSharp doesn't try to convert that underlying type to its blittable version but instead assumes that it is instead some other user-defined type. Also I'm not sure what the _S prefix is meant to mean in this case. Basically I'd have assumed that if ClangSharp didn't like the typedef, it would still convert FILE* to IntPtr or some equivalent handle type. |
ClangSharp only handles a subset of very well-defined and common types, not all C/C++ defined types. There are many cases, like I'm open to additional types being recognized implicitly, but they need to be well reasoned about and with well understood behavior when encountered. The default remappings are currently handled here: ClangSharp/sources/ClangSharp.PInvokeGenerator/PInvokeGeneratorConfiguration.cs Lines 135 to 138 in 03746e3
The
|
All makes sense! I also had converted locally FILE* to void*, and can just add it to my own remappings for now. As you said I |
I'm wrapping cimgui.h and one thing it does is typedef common types for its wrapped library (imgui) so they work in the "API" layer it builds. So things like:
I don't totally understand it, and I think it all works for ClangSharp, but an issue I'm having specifically with the
ImFileHandle
typedef is that ClangSharp is skipping the typedef and (trying) to use FILE* directly, so instead of getting a struct sig like this:It's generating
And then the
__sFILE*
symbol isn't actually defined anywhere, so it's erroring.Would love to know if there is any way around this or if I'm missing something — thanks!
The text was updated successfully, but these errors were encountered: