diff options
-rw-r--r-- | CMakeLists.txt | 4 | ||||
-rw-r--r-- | lib/threads.c | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a583a6f..8ae8615 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,3 +41,7 @@ else() message(FATAL_ERROR "no threading system (pthread or Win32) available") endif() endif() + +IF(LUALIB) + TARGET_LINK_LIBRARIES(threadsmain ${LUALIB}) +ENDIF() diff --git a/lib/threads.c b/lib/threads.c index fbb8d60..6d845c4 100644 --- a/lib/threads.c +++ b/lib/threads.c @@ -20,7 +20,11 @@ static int thread_new(lua_State *L) luaL_error(L, "threads: out of memory"); memcpy(code_dup, code, len+1); +#ifdef RTLD_NODELETE /* platforms like android dont seem to support this */ void* lib = dlopen("libthreadsmain.so", RTLD_LAZY|RTLD_LOCAL|RTLD_NODELETE); +#else + void* lib = dlopen("libthreadsmain.so", RTLD_LAZY|RTLD_LOCAL); +#endif if (!lib) { free(code_dup); luaL_error(L, "threads: dlopen: %s", dlerror()); |