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

Alexandre Julliard julliard at winehq.org
Tue Apr 7 15:27:15 CDT 2020


Module: wine
Branch: master
Commit: 57d5cf0345bb5b5ec0d3e1a649058ab54bbb2a0b
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=57d5cf0345bb5b5ec0d3e1a649058ab54bbb2a0b

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Apr  6 22:40:19 2020 +0200

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

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wineandroid.drv/init.c     | 19 ++++++++-----------
 dlls/wineandroid.drv/mmdevdrv.c |  8 +++-----
 dlls/wineandroid.drv/opengl.c   | 16 +++++++---------
 3 files changed, 18 insertions(+), 25 deletions(-)

diff --git a/dlls/wineandroid.drv/init.c b/dlls/wineandroid.drv/init.c
index f02b163831..7b2850e452 100644
--- a/dlls/wineandroid.drv/init.c
+++ b/dlls/wineandroid.drv/init.c
@@ -32,7 +32,6 @@
 #include "winreg.h"
 #include "android.h"
 #include "wine/server.h"
-#include "wine/library.h"
 #include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(android);
@@ -444,7 +443,7 @@ static const JNINativeMethod methods[] =
 
 #define DECL_FUNCPTR(f) typeof(f) * p##f = NULL
 #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; } \
     } while(0)
 
@@ -567,9 +566,8 @@ static void load_hardware_libs(void)
     const struct hw_module_t *module;
     int ret;
     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 );
     }
@@ -578,9 +576,9 @@ static void load_hardware_libs(void)
         /* Android >= N disallows loading libhardware, so we load libandroid (which imports
          * 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;
         }
         dl_iterate_phdr( enum_libs, 0 );
@@ -603,16 +601,15 @@ static void load_hardware_libs(void)
 static void load_android_libs(void)
 {
     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;
     }
-    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;
     }
     LOAD_FUNCPTR( liblog, __android_log_print );
diff --git a/dlls/wineandroid.drv/mmdevdrv.c b/dlls/wineandroid.drv/mmdevdrv.c
index 608e16a7a7..b4d8564256 100644
--- a/dlls/wineandroid.drv/mmdevdrv.c
+++ b/dlls/wineandroid.drv/mmdevdrv.c
@@ -46,7 +46,6 @@
 #include "wine/debug.h"
 #include "wine/unicode.h"
 #include "wine/list.h"
-#include "wine/library.h"
 
 #include "ole2.h"
 #include "mmdeviceapi.h"
@@ -237,7 +236,7 @@ static inline SessionMgr *impl_from_IAudioSessionManager2(IAudioSessionManager2
 }
 
 #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; } \
     } 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 )
 {
     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;
     }
     LOAD_FUNCPTR( libopensles, slCreateEngine );
diff --git a/dlls/wineandroid.drv/opengl.c b/dlls/wineandroid.drv/opengl.c
index 77c88f7817..93e77c423b 100644
--- a/dlls/wineandroid.drv/opengl.c
+++ b/dlls/wineandroid.drv/opengl.c
@@ -42,7 +42,6 @@
 #include "wine/wgl.h"
 #undef GLAPIENTRY
 #include "wine/wgl_driver.h"
-#include "wine/library.h"
 #include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(android);
@@ -655,11 +654,11 @@ static void init_extensions(void)
 
     /* 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
 #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( glActiveTexture );
     LOAD_FUNCPTR( glAttachShader );
@@ -949,24 +948,23 @@ static BOOL egl_init(void)
     static int retval = -1;
     EGLConfig *configs;
     EGLint major, minor, count, i, pass;
-    char buffer[200];
 
     if (retval != -1) return retval;
     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;
     }
-    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;
     }
 
 #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; }    \
     } while(0)
     LOAD_FUNCPTR( eglCreateContext );




More information about the wine-cvs mailing list