Commit 3f45def3 authored by David Reid's avatar David Reid

Don't use run-time linking of pthread on Android nor Emscripten.

parent ce054406
...@@ -1579,6 +1579,11 @@ void mal_pcm_convert(void* pOut, mal_format formatOut, const void* pIn, mal_form ...@@ -1579,6 +1579,11 @@ void mal_pcm_convert(void* pOut, mal_format formatOut, const void* pIn, mal_form
#define MAL_HAS_NULL // Everything supports the null backend. #define MAL_HAS_NULL // Everything supports the null backend.
#endif #endif
// Disable run-time linking on certain backends.
#if defined(MAL_ANDROID) || defined(MAL_EMSCRIPTED)
#define MAL_NO_RUNTIME_LINKING
#endif
#ifdef MAL_WIN32 #ifdef MAL_WIN32
#define MAL_THREADCALL WINAPI #define MAL_THREADCALL WINAPI
...@@ -8485,6 +8490,7 @@ mal_result mal_context_uninit_backend_apis__nix(mal_context* pContext) ...@@ -8485,6 +8490,7 @@ mal_result mal_context_uninit_backend_apis__nix(mal_context* pContext)
mal_result mal_context_init_backend_apis__nix(mal_context* pContext) mal_result mal_context_init_backend_apis__nix(mal_context* pContext)
{ {
// pthread // pthread
#if !defined(MAL_NO_RUNTIME_LINKING)
const char* libpthreadFileNames[] = { const char* libpthreadFileNames[] = {
"libpthread.so", "libpthread.so",
"libpthread.so.0", "libpthread.so.0",
...@@ -8512,6 +8518,18 @@ mal_result mal_context_init_backend_apis__nix(mal_context* pContext) ...@@ -8512,6 +8518,18 @@ mal_result mal_context_init_backend_apis__nix(mal_context* pContext)
pContext->posix.pthread_cond_destroy = (mal_proc)mal_dlsym(pContext->posix.pthreadSO, "pthread_cond_destroy"); pContext->posix.pthread_cond_destroy = (mal_proc)mal_dlsym(pContext->posix.pthreadSO, "pthread_cond_destroy");
pContext->posix.pthread_cond_wait = (mal_proc)mal_dlsym(pContext->posix.pthreadSO, "pthread_cond_wait"); pContext->posix.pthread_cond_wait = (mal_proc)mal_dlsym(pContext->posix.pthreadSO, "pthread_cond_wait");
pContext->posix.pthread_cond_signal = (mal_proc)mal_dlsym(pContext->posix.pthreadSO, "pthread_cond_signal"); pContext->posix.pthread_cond_signal = (mal_proc)mal_dlsym(pContext->posix.pthreadSO, "pthread_cond_signal");
#else
pContext->posix.pthread_create = (mal_proc)pthread_create;
pContext->posix.pthread_join = (mal_proc)pthread_join;
pContext->posix.pthread_mutex_init = (mal_proc)pthread_mutex_init;
pContext->posix.pthread_mutex_destroy = (mal_proc)pthread_mutex_destroy;
pContext->posix.pthread_mutex_lock = (mal_proc)pthread_mutex_lock;
pContext->posix.pthread_mutex_unlock = (mal_proc)pthread_mutex_unlock;
pContext->posix.pthread_cond_init = (mal_proc)pthread_cond_init;
pContext->posix.pthread_cond_destroy = (mal_proc)pthread_cond_destroy;
pContext->posix.pthread_cond_wait = (mal_proc)pthread_cond_wait;
pContext->posix.pthread_cond_signal = (mal_proc)pthread_cond_signal;
#endif
return MAL_SUCCESS; return MAL_SUCCESS;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment