-
Notifications
You must be signed in to change notification settings - Fork 511
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
[Generator] Generator does not create BlittablePInvokes when a boolean is present in a parameter #18685
Comments
We have a rather long list of known failures:
Most of these are due to limitations in the generator that needs to be fixed, so just add the new signature there. Keeping this bug open to fix the generator (and the corresponding known failures). |
rolfbjarne
added a commit
to rolfbjarne/xamarin-macios
that referenced
this issue
Sep 15, 2023
rolfbjarne
added a commit
to rolfbjarne/xamarin-macios
that referenced
this issue
Sep 18, 2023
…marin#18685. This means: * Change all bool and char arguments in P/Invokes to be byte and ushort, respectively. * Change all out/ref arguments to be pointers instead. * Update managed binding code accordingly. * Update a struct (GKTriangle) to not use a MarshalAs field, but instead only use blittable fields. * Update tests accordingly. Fixes xamarin#18685.
rolfbjarne
added a commit
that referenced
this issue
Sep 19, 2023
…8685. (#19034) This means: * Change all bool and char arguments in P/Invokes to be byte and ushort, respectively. * Change all out/ref arguments to be pointers instead. * Update managed binding code accordingly. * Update a struct (GKTriangle) to not use a MarshalAs field, but instead only use blittable fields. * Update tests accordingly. One side effect is that legacy binding projects may need a reference to the `System.Runtime.CompilerServices.Unsafe` NuGet now (this is a built-in dependency in .NET) in order to compile successfully. Fixes #18685.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When we did not need to worry about NativeAOT we could write a binding in the following way:
Yet, now the above code will result in the following cecil test failure:
You can see that one of the offending methods is:
A workaround to the issue is to change the binding to the following:
NONE of or users expect to have to change all their bindings that take a boolean to take a byte and do a wrap with
hasFullSizeContent ? (byte) 1 : (byte) 0
.Either the test is wrong or the generator needs to be able to deal with the boolean parameter without asking the user to do the conversion to a byte.
The text was updated successfully, but these errors were encountered: