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

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2020-04-06 22:41:34 +02:00
parent 3760b7a9f8
commit 73effb1ab6
2 changed files with 10 additions and 13 deletions

View File

@ -27,7 +27,6 @@
#include "winuser.h" #include "winuser.h"
#include "winternl.h" #include "winternl.h"
#include "winnt.h" #include "winnt.h"
#include "wine/library.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/wgl.h" #include "wine/wgl.h"
#include "wine/wgl_driver.h" #include "wine/wgl_driver.h"
@ -4247,7 +4246,6 @@ static BOOL init_opengl(void)
{ {
static BOOL init_done = FALSE; static BOOL init_done = FALSE;
unsigned int i; unsigned int i;
char buffer[200];
if (init_done) return (opengl_handle != NULL); if (init_done) return (opengl_handle != NULL);
init_done = TRUE; init_done = TRUE;
@ -4261,17 +4259,17 @@ static BOOL init_opengl(void)
return FALSE; return FALSE;
} }
opengl_handle = wine_dlopen("/System/Library/Frameworks/OpenGL.framework/OpenGL", RTLD_LAZY|RTLD_LOCAL|RTLD_NOLOAD, buffer, sizeof(buffer)); opengl_handle = dlopen("/System/Library/Frameworks/OpenGL.framework/OpenGL", RTLD_LAZY|RTLD_LOCAL|RTLD_NOLOAD);
if (!opengl_handle) if (!opengl_handle)
{ {
ERR("Failed to load OpenGL: %s\n", buffer); ERR("Failed to load OpenGL: %s\n", dlerror());
ERR("OpenGL support is disabled.\n"); ERR("OpenGL support is disabled.\n");
return FALSE; return FALSE;
} }
for (i = 0; i < ARRAY_SIZE(opengl_func_names); i++) for (i = 0; i < ARRAY_SIZE(opengl_func_names); i++)
{ {
if (!(((void **)&opengl_funcs.gl)[i] = wine_dlsym(opengl_handle, opengl_func_names[i], NULL, 0))) if (!(((void **)&opengl_funcs.gl)[i] = dlsym(opengl_handle, opengl_func_names[i])))
{ {
ERR("%s not found in OpenGL, disabling.\n", opengl_func_names[i]); ERR("%s not found in OpenGL, disabling.\n", opengl_func_names[i]);
goto failed; goto failed;
@ -4296,12 +4294,12 @@ static BOOL init_opengl(void)
/* redirect some OpenGL extension functions */ /* redirect some OpenGL extension functions */
#define REDIRECT(func) \ #define REDIRECT(func) \
do { if ((p##func = wine_dlsym(opengl_handle, #func, NULL, 0))) { opengl_funcs.ext.p_##func = macdrv_##func; } } while(0) do { if ((p##func = dlsym(opengl_handle, #func))) { opengl_funcs.ext.p_##func = macdrv_##func; } } while(0)
REDIRECT(glCopyColorTable); REDIRECT(glCopyColorTable);
#undef REDIRECT #undef REDIRECT
if (gluCheckExtension((GLubyte*)"GL_APPLE_flush_render", (GLubyte*)gl_info.glExtensions)) if (gluCheckExtension((GLubyte*)"GL_APPLE_flush_render", (GLubyte*)gl_info.glExtensions))
pglFlushRenderAPPLE = wine_dlsym(opengl_handle, "glFlushRenderAPPLE", NULL, 0); pglFlushRenderAPPLE = dlsym(opengl_handle, "glFlushRenderAPPLE");
load_extensions(); load_extensions();
if (!init_pixel_formats()) if (!init_pixel_formats())
@ -4310,7 +4308,7 @@ static BOOL init_opengl(void)
return TRUE; return TRUE;
failed: failed:
wine_dlclose(opengl_handle, NULL, 0); dlclose(opengl_handle);
opengl_handle = NULL; opengl_handle = NULL;
return FALSE; return FALSE;
} }
@ -4479,7 +4477,7 @@ static PROC macdrv_wglGetProcAddress(const char *proc)
void *ret; void *ret;
if (!strncmp(proc, "wgl", 3)) return NULL; if (!strncmp(proc, "wgl", 3)) return NULL;
ret = wine_dlsym(opengl_handle, proc, NULL, 0); ret = dlsym(opengl_handle, proc);
if (ret) if (ret)
{ {
if (TRACE_ON(wgl)) if (TRACE_ON(wgl))

View File

@ -33,7 +33,6 @@
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h" #include "wine/heap.h"
#include "wine/library.h"
#define VK_NO_PROTOTYPES #define VK_NO_PROTOTYPES
#define WINE_VK_HOST #define WINE_VK_HOST
@ -107,13 +106,13 @@ static void *vulkan_handle;
static BOOL WINAPI wine_vk_init(INIT_ONCE *once, void *param, void **context) static BOOL WINAPI wine_vk_init(INIT_ONCE *once, void *param, void **context)
{ {
if (!(vulkan_handle = wine_dlopen(SONAME_LIBMOLTENVK, RTLD_NOW, NULL, 0))) if (!(vulkan_handle = dlopen(SONAME_LIBMOLTENVK, RTLD_NOW)))
{ {
ERR("Failed to load %s\n", SONAME_LIBMOLTENVK); ERR("Failed to load %s\n", SONAME_LIBMOLTENVK);
return TRUE; return TRUE;
} }
#define LOAD_FUNCPTR(f) if ((p##f = wine_dlsym(vulkan_handle, #f, NULL, 0)) == NULL) goto fail; #define LOAD_FUNCPTR(f) if ((p##f = dlsym(vulkan_handle, #f)) == NULL) goto fail;
LOAD_FUNCPTR(vkCreateInstance) LOAD_FUNCPTR(vkCreateInstance)
LOAD_FUNCPTR(vkCreateSwapchainKHR) LOAD_FUNCPTR(vkCreateSwapchainKHR)
LOAD_FUNCPTR(vkCreateMacOSSurfaceMVK) LOAD_FUNCPTR(vkCreateMacOSSurfaceMVK)
@ -137,7 +136,7 @@ static BOOL WINAPI wine_vk_init(INIT_ONCE *once, void *param, void **context)
return TRUE; return TRUE;
fail: fail:
wine_dlclose(vulkan_handle, NULL, 0); dlclose(vulkan_handle);
vulkan_handle = NULL; vulkan_handle = NULL;
return TRUE; return TRUE;
} }