Mono performs a lot of location probing when trying to find a shared library managed code tries to p/invoke into. This is not necessary on Android which won't have any DSOs in any of the locations probed by Mono.
There's also no pre-determined location where app shared libraries are, Xamarin.Android learns about the location(s) only when it's started - they are passed as application startup arguments (both filesystem locations
and APK locations). Mono should simply always call the Xamarin.Androiddlopen hook, except when it sees that the p/invoke library name matches one of the following:
The list is taken from the Android NDK, by listing any of the platforms/android-API_LEVEL/arch-*/usr/lib directories and it names the only "blessed" shared libraries that are accessible to the application in /system.
At the same time, Mono should not stat the files in /system if it sees any of the above names, but simply issue a dlopen + dlsym for the specified name.
Mono performs a lot of location probing when trying to find a shared library managed code tries to p/invoke into. This is not necessary on Android which won't have any DSOs in any of the locations probed by Mono. There's also no pre-determined location where app shared libraries are,
Xamarin.Android
learns about the location(s) only when it's started - they are passed as application startup arguments (both filesystem locations and APK locations). Mono should simply always call theXamarin.Android
dlopen
hook, except when it sees that the p/invoke library name matches one of the following:The list is taken from the Android NDK, by listing any of the
platforms/android-API_LEVEL/arch-*/usr/lib
directories and it names the only "blessed" shared libraries that are accessible to the application in/system
. At the same time, Mono should notstat
the files in/system
if it sees any of the above names, but simply issue adlopen
+dlsym
for the specified name./cc @CoffeeFlux