wineandroid: Use standard dlopen() instead of the libwine wrappers.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
feature/deterministic
Alexandre Julliard 2020-04-06 22:40:19 +02:00
parent 7cb1ac7ba2
commit 57d5cf0345
3 changed files with 18 additions and 25 deletions

View File

@ -32,7 +32,6 @@
#include "winreg.h" #include "winreg.h"
#include "android.h" #include "android.h"
#include "wine/server.h" #include "wine/server.h"
#include "wine/library.h"
#include "wine/debug.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(android); WINE_DEFAULT_DEBUG_CHANNEL(android);
@ -444,7 +443,7 @@ static const JNINativeMethod methods[] =
#define DECL_FUNCPTR(f) typeof(f) * p##f = NULL #define DECL_FUNCPTR(f) typeof(f) * p##f = NULL
#define LOAD_FUNCPTR(lib, func) do { \ #define LOAD_FUNCPTR(lib, func) do { \
if ((p##func = wine_dlsym( lib, #func, NULL, 0 )) == NULL) \ if ((p##func = dlsym( lib, #func )) == NULL) \
{ ERR( "can't find symbol %s\n", #func); return; } \ { ERR( "can't find symbol %s\n", #func); return; } \
} while(0) } while(0)
@ -567,9 +566,8 @@ static void load_hardware_libs(void)
const struct hw_module_t *module; const struct hw_module_t *module;
int ret; int ret;
void *libhardware; void *libhardware;
char error[256];
if ((libhardware = wine_dlopen( "libhardware.so", RTLD_GLOBAL, error, sizeof(error) ))) if ((libhardware = dlopen( "libhardware.so", RTLD_GLOBAL )))
{ {
LOAD_FUNCPTR( libhardware, hw_get_module ); LOAD_FUNCPTR( libhardware, hw_get_module );
} }
@ -578,9 +576,9 @@ static void load_hardware_libs(void)
/* Android >= N disallows loading libhardware, so we load libandroid (which imports /* Android >= N disallows loading libhardware, so we load libandroid (which imports
* libhardware), and then we can find libhardware in the list of loaded libraries. * libhardware), and then we can find libhardware in the list of loaded libraries.
*/ */
if (!wine_dlopen( "libandroid.so", RTLD_GLOBAL, error, sizeof(error) )) if (!dlopen( "libandroid.so", RTLD_GLOBAL ))
{ {
ERR( "failed to load libandroid.so: %s\n", error ); ERR( "failed to load libandroid.so: %s\n", dlerror() );
return; return;
} }
dl_iterate_phdr( enum_libs, 0 ); dl_iterate_phdr( enum_libs, 0 );
@ -603,16 +601,15 @@ static void load_hardware_libs(void)
static void load_android_libs(void) static void load_android_libs(void)
{ {
void *libandroid, *liblog; void *libandroid, *liblog;
char error[1024];
if (!(libandroid = wine_dlopen( "libandroid.so", RTLD_GLOBAL, error, sizeof(error) ))) if (!(libandroid = dlopen( "libandroid.so", RTLD_GLOBAL )))
{ {
ERR( "failed to load libandroid.so: %s\n", error ); ERR( "failed to load libandroid.so: %s\n", dlerror() );
return; return;
} }
if (!(liblog = wine_dlopen( "liblog.so", RTLD_GLOBAL, error, sizeof(error) ))) if (!(liblog = dlopen( "liblog.so", RTLD_GLOBAL )))
{ {
ERR( "failed to load liblog.so: %s\n", error ); ERR( "failed to load liblog.so: %s\n", dlerror() );
return; return;
} }
LOAD_FUNCPTR( liblog, __android_log_print ); LOAD_FUNCPTR( liblog, __android_log_print );

View File

@ -46,7 +46,6 @@
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h" #include "wine/unicode.h"
#include "wine/list.h" #include "wine/list.h"
#include "wine/library.h"
#include "ole2.h" #include "ole2.h"
#include "mmdeviceapi.h" #include "mmdeviceapi.h"
@ -237,7 +236,7 @@ static inline SessionMgr *impl_from_IAudioSessionManager2(IAudioSessionManager2
} }
#define LOAD_FUNCPTR(lib, func) do { \ #define LOAD_FUNCPTR(lib, func) do { \
if ((p##func = wine_dlsym( lib, #func, NULL, 0 )) == NULL) \ if ((p##func = dlsym( lib, #func )) == NULL) \
{ ERR( "can't find symbol %s\n", #func); return FALSE; } \ { ERR( "can't find symbol %s\n", #func); return FALSE; } \
} while(0) } while(0)
@ -246,11 +245,10 @@ static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT;
static BOOL WINAPI load_opensles( INIT_ONCE *once, void *param, void **context ) static BOOL WINAPI load_opensles( INIT_ONCE *once, void *param, void **context )
{ {
void *libopensles; void *libopensles;
char error[1024];
if (!(libopensles = wine_dlopen( "libOpenSLES.so", RTLD_GLOBAL, error, sizeof(error) ))) if (!(libopensles = dlopen( "libOpenSLES.so", RTLD_GLOBAL )))
{ {
ERR( "failed to load libOpenSLES.so: %s\n", error ); ERR( "failed to load libOpenSLES.so: %s\n", dlerror() );
return FALSE; return FALSE;
} }
LOAD_FUNCPTR( libopensles, slCreateEngine ); LOAD_FUNCPTR( libopensles, slCreateEngine );

View File

@ -42,7 +42,6 @@
#include "wine/wgl.h" #include "wine/wgl.h"
#undef GLAPIENTRY #undef GLAPIENTRY
#include "wine/wgl_driver.h" #include "wine/wgl_driver.h"
#include "wine/library.h"
#include "wine/debug.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(android); WINE_DEFAULT_DEBUG_CHANNEL(android);
@ -655,11 +654,11 @@ static void init_extensions(void)
/* load standard functions and extensions exported from the OpenGL library */ /* load standard functions and extensions exported from the OpenGL library */
#define USE_GL_FUNC(func) if ((ptr = wine_dlsym( opengl_handle, #func, NULL, 0 ))) egl_funcs.gl.p_##func = ptr; #define USE_GL_FUNC(func) if ((ptr = dlsym( opengl_handle, #func ))) egl_funcs.gl.p_##func = ptr;
ALL_WGL_FUNCS ALL_WGL_FUNCS
#undef USE_GL_FUNC #undef USE_GL_FUNC
#define LOAD_FUNCPTR(func) egl_funcs.ext.p_##func = wine_dlsym( opengl_handle, #func, NULL, 0 ) #define LOAD_FUNCPTR(func) egl_funcs.ext.p_##func = dlsym( opengl_handle, #func )
LOAD_FUNCPTR( glActiveShaderProgram ); LOAD_FUNCPTR( glActiveShaderProgram );
LOAD_FUNCPTR( glActiveTexture ); LOAD_FUNCPTR( glActiveTexture );
LOAD_FUNCPTR( glAttachShader ); LOAD_FUNCPTR( glAttachShader );
@ -949,24 +948,23 @@ static BOOL egl_init(void)
static int retval = -1; static int retval = -1;
EGLConfig *configs; EGLConfig *configs;
EGLint major, minor, count, i, pass; EGLint major, minor, count, i, pass;
char buffer[200];
if (retval != -1) return retval; if (retval != -1) return retval;
retval = 0; retval = 0;
if (!(egl_handle = wine_dlopen( SONAME_LIBEGL, RTLD_NOW|RTLD_GLOBAL, buffer, sizeof(buffer) ))) if (!(egl_handle = dlopen( SONAME_LIBEGL, RTLD_NOW|RTLD_GLOBAL )))
{ {
ERR( "failed to load %s: %s\n", SONAME_LIBEGL, buffer ); ERR( "failed to load %s: %s\n", SONAME_LIBEGL, dlerror() );
return FALSE; return FALSE;
} }
if (!(opengl_handle = wine_dlopen( SONAME_LIBGLESV2, RTLD_NOW|RTLD_GLOBAL, buffer, sizeof(buffer) ))) if (!(opengl_handle = dlopen( SONAME_LIBGLESV2, RTLD_NOW|RTLD_GLOBAL )))
{ {
ERR( "failed to load %s: %s\n", SONAME_LIBGLESV2, buffer ); ERR( "failed to load %s: %s\n", SONAME_LIBGLESV2, dlerror() );
return FALSE; return FALSE;
} }
#define LOAD_FUNCPTR(func) do { \ #define LOAD_FUNCPTR(func) do { \
if (!(p_##func = wine_dlsym( egl_handle, #func, NULL, 0 ))) \ if (!(p_##func = dlsym( egl_handle, #func ))) \
{ ERR( "can't find symbol %s\n", #func); return FALSE; } \ { ERR( "can't find symbol %s\n", #func); return FALSE; } \
} while(0) } while(0)
LOAD_FUNCPTR( eglCreateContext ); LOAD_FUNCPTR( eglCreateContext );