You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Mono.Android] Don't use __Internal in our P/Invoke calls (#4757)
Context: #4914
Context: d583b7c
Context: mono/mono#20295 (comment)
Context? mono/mono#17369
Context? mono/mono@d5b6cf3
As a runtime extension, Mono long supported `[DllImport("__Internal")]`
as a synonym for [`dlopen(NULL, 0)`][0]. Unfortunately, this
[did not work on Android][1] -- Bionic would SIGSEGV when the
filename parameter was `NULL` -- and as "fallout" of this change the
`loader_func` that Xamarin.Android registers with mono via
`mono_dl_fallback_register()` would be invoked *instead of*
`dlopen(NULL)` when loading `__Internal`…but *only* on Android.
Use of this feature remains widely used in Xamarin.Android, e.g.
[`java-interop` is mapped to `__Internal`][2], avoiding the need to
build and ship a separate `libjava-interop.so` library.
Unfortunately, as part of .NET 5, MonoVM will be overhauling the
semantics of `[DllImport("__Internal")]`, preventing `loader_func`
from being invoked on Android to resolve `__Internal`.
Consequently, we need to begin moving away from use of `__Internal`.
Begin this process, and remove all P/Invokes to `__Internal` within
`Mono.Android.dll` with P/Invokes to `xa-internal-api` (d583b7c).
[0]: https://linux.die.net/man/3/dlopen
[1]: mono/mono@9b73cd9
[2]: https://github.com/xamarin/xamarin-android/blob/faf1d16692ead1115d34fdf7b84c256c94a321da/src/monodroid/config.xml#L2
0 commit comments