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
added additional wide string support for marshalling wide strings #122
Conversation
…ethodDef.Name)' again; added char* support for easier LPStr and LPWStr marshalling
Co-authored-by: Aaron Robinson <arobins@microsoft.com>
Co-authored-by: Aaron Robinson <arobins@microsoft.com>
Co-authored-by: Aaron Robinson <arobins@microsoft.com>
Co-authored-by: Aaron Robinson <arobins@microsoft.com>
Co-authored-by: Aaron Robinson <arobins@microsoft.com>
This reverts commit bab6609.
I reverted the boolean commit |
Thank you much! Do you need package published soon? |
No hurry. I was looking for the boolean part to be in there. Please let me know what would be an acceptable boolean support, because at some point you will need to specify how booleans are coming in and out. Because if you do not control the part of the caller, you have to code UnmanagedType.U1 or UnmanagedType.Bool as boolean marshalling. If I find a solution that would allow such a statement: [UnmanagedCallersOnly]
// return bool defaults to C99 'bool'
public static bool Something(){}
[UnmanagedCallersOnly]
[return: MarshalAs(UnmanagedType.Bool)] // use Win32 'BOOL'
public static bool Something(){} Would that be ok with you? |
One of the main principals of DNNE is ensure there is no marshalling involved at all. This means we are simply exposing types to the C environment and as such we are required to follow what C guarantees. In this case, the size of C-bool is implementation defined. I believe since C99, even This doesn't mean there is no hope, but it does mean we need to understand what guarantees we can rely on. Since |
I understand you to keep things as small and understandable as possible for people. But I also noticed that I'm not the only one who would like to have that boolean support. When I search the net, I can only find the C99 And because we only use the "MarshalAs" to let your gen tool know what byte conversation we would like (either Anyway, thanks for the awesome project! I guess I will use |
added char* (C#) support for export (gen tool)
improved some code
added string-testing unit tests
some code has been formatted due to auto format