mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2024-12-17 17:20:21 +01:00
android: prevent UnsatisfiedLinkError on Android <9
This commit is contained in:
+5
-2
@@ -61,8 +61,11 @@ fun initHaskell() {
|
||||
}
|
||||
}
|
||||
|
||||
System.loadLibrary("app-lib")
|
||||
|
||||
try {
|
||||
System.loadLibrary("app-lib")
|
||||
} catch (e: UnsatisfiedLinkError) {
|
||||
System.loadLibrary("apppatched-lib")
|
||||
}
|
||||
s.acquire()
|
||||
pipeStdOutToSocket(socketName)
|
||||
|
||||
|
||||
@@ -23,6 +23,15 @@ add_library( # Sets the name of the library.
|
||||
# Provides a relative path to your source file(s).
|
||||
simplex-api.c)
|
||||
|
||||
add_library( # Sets the name of the library.
|
||||
apppatched-lib
|
||||
|
||||
# Sets the library as a shared library.
|
||||
SHARED
|
||||
|
||||
# Provides a relative path to your source file(s).
|
||||
patch.c simplex-api.c)
|
||||
|
||||
# Searches for a specified prebuilt library and stores the path as a
|
||||
# variable. Because CMake includes system libraries in the search path by
|
||||
# default, you only need to specify the name of the public NDK library
|
||||
@@ -65,3 +74,13 @@ target_link_libraries( # Specifies the target library.
|
||||
# Links the target library to the log library
|
||||
# included in the NDK.
|
||||
${log-lib})
|
||||
|
||||
|
||||
target_link_libraries( # Specifies the target library.
|
||||
apppatched-lib
|
||||
|
||||
simplex support
|
||||
|
||||
# Links the target library to the log library
|
||||
# included in the NDK.
|
||||
${log-lib})
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
#include <stdint.h>
|
||||
|
||||
extern int getentropy(void* __buffer, size_t __buffer_size)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@@ -19,6 +19,8 @@ extern void __strcat_chk_generic(void){};
|
||||
extern void __libc_globals(void){};
|
||||
extern void __rel_iplt_start(void){};
|
||||
|
||||
int getentropy(void* __buffer, size_t __buffer_size);
|
||||
|
||||
// Android 9 only, not 13
|
||||
extern void reallocarray(void){};
|
||||
|
||||
@@ -32,6 +34,8 @@ Java_chat_simplex_common_platform_CoreKt_pipeStdOutToSocket(JNIEnv *env, __unuse
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_chat_simplex_common_platform_CoreKt_initHS(__unused JNIEnv *env, __unused jclass clazz) {
|
||||
//char tmp;
|
||||
//__android_log_print(ANDROID_LOG_ERROR, "simplex", "entropy %d\n", getentropy(&tmp, sizeof(tmp)));
|
||||
hs_init(NULL, NULL);
|
||||
setLineBuffering();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user