-
Notifications
You must be signed in to change notification settings - Fork 555
[CoreCLR] Support marshal methods #9912
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
Conversation
…al/coreclr-marshal-methods
8524974
to
3780ce6
Compare
|
||
[[gnu::visibility("default")]] extern void xamarin_app_init (JNIEnv *env, get_function_pointer_fn fn) noexcept; | ||
#endif // def RELEASE | ||
extern "C" [[gnu::visibility("default")]] void xamarin_app_init (JNIEnv *env, get_function_pointer_fn fn) noexcept; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this moved outside of the #if RELEASE
block? Is it somehow present in Debug config builds? (Are those even meaningfully supported at present?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…or maybe it always needs to exist because it's in the pinvoke-tables…
This is a follow-up to #9805 and #9900
This PR makes it possible to enable marshal methods in CoreCLR apps in the Release configuration by using the
$(AndroidEnableMarshalMethods)=true
.Note: It is not necessary to set
$(_AndroidUseManagedMarshalMethodsLookup)=true
manually when using CoreCLR. This is because the it is the only marshal methods lookup method supported on CoreCLR.This PR contains the following changes:
xamarin_app_init
method is added to the pinvoke overridesxamarin_app_init
method is called when$(AndroidEnableMarshalMethods)=true
._mm_wrapper
method for methods which already have[UnmanagedCallersOnly]
attributesin
MarshalMethodsAssemblyRewriter
. There was a bug in [Experimental] Add alternative way of resolving UCO function pointers for Marshal Methods #9805 which created an_Activate_mm_mm_wrapper
UCO which called the hand-written
n_Activate_mm
UCO. This wasn't caught earlier because Mono does not throwwhen a managed function calls an UCO. On CoreCLR, this codepath failed with
Invalid Program: attempted to call a UnmanagedCallersOnly method from managed code.
.