@@ -88,7 +88,7 @@ namespace xamarin::android {
88
88
89
89
static auto load_jni (std::string_view const & name, bool name_is_path) -> void*
90
90
{
91
- log_debug (LOG_ASSEMBLY, " Loading JNI library {} with System.loadLibrary" , name);
91
+ log_debug (LOG_ASSEMBLY, " Trying to load loading shared JNI library {} with System.loadLibrary" , name);
92
92
93
93
if (jni_env == nullptr || systemKlass == nullptr ) [[unlikely]] {
94
94
Helpers::abort_application (" DSO loader class not initialized properly." sv);
@@ -130,6 +130,8 @@ namespace xamarin::android {
130
130
return name;
131
131
};
132
132
133
+ // std::string is needed because we must pass a NUL-terminated string to Java, otherwise
134
+ // strange things happen (and std::string_view is not necessarily such a string)
133
135
const std::string undecorated_lib_name { get_undecorated_name (name, name_is_path) };
134
136
log_debug (LOG_ASSEMBLY, " Undecorated library name: {}" , undecorated_lib_name);
135
137
@@ -142,6 +144,8 @@ namespace xamarin::android {
142
144
143
145
// This is unfortunate, but since `System.loadLibrary` doesn't return the class handle, we must get it this
144
146
// way :(
147
+ // We must use full name of the library, because dlopen won't accept an undecorated one without kicking up
148
+ // a fuss.
145
149
log_debug (LOG_ASSEMBLY, " Attempting to get library {} handle after System.loadLibrary" , name);
146
150
return log_and_return (dlopen (name.data (), RTLD_NOLOAD), name);
147
151
}
0 commit comments