From a58e713314486521d990c5aef619df3a5db34067 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 18 Apr 2022 20:28:41 -0500 Subject: [PATCH] include: Move vkd3d_dl*() helpers to vkd3d_common.h. Signed-off-by: Zebediah Figura Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- include/private/vkd3d_common.h | 44 +++++++++++++++++++++++++++++++++ libs/vkd3d/device.c | 45 ---------------------------------- 2 files changed, 44 insertions(+), 45 deletions(-) diff --git a/include/private/vkd3d_common.h b/include/private/vkd3d_common.h index 11acc643..7aabe8ab 100644 --- a/include/private/vkd3d_common.h +++ b/include/private/vkd3d_common.h @@ -246,4 +246,48 @@ static inline void vkd3d_parse_version(const char *version, int *major, int *min HRESULT hresult_from_vkd3d_result(int vkd3d_result); +#ifdef HAVE_DLFCN_H +#include + +static inline void *vkd3d_dlopen(const char *name) +{ + return dlopen(name, RTLD_NOW); +} + +static inline void *vkd3d_dlsym(void *handle, const char *symbol) +{ + return dlsym(handle, symbol); +} + +static inline int vkd3d_dlclose(void *handle) +{ + return dlclose(handle); +} + +static inline const char *vkd3d_dlerror(void) +{ + return dlerror(); +} +#else +static inline void *vkd3d_dlopen(const char *name) +{ + return NULL; +} + +static inline void *vkd3d_dlsym(void *handle, const char *symbol) +{ + return NULL; +} + +static inline int vkd3d_dlclose(void *handle) +{ + return 0; +} + +static inline const char *vkd3d_dlerror(void) +{ + return "Not implemented for this platform.\n"; +} +#endif + #endif /* __VKD3D_COMMON_H */ diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c index ab087d60..0b643727 100644 --- a/libs/vkd3d/device.c +++ b/libs/vkd3d/device.c @@ -19,51 +19,6 @@ #include "vkd3d_private.h" #include "vkd3d_version.h" -#ifdef HAVE_DLFCN_H -#include - -static void *vkd3d_dlopen(const char *name) -{ - return dlopen(name, RTLD_NOW); -} - -static void *vkd3d_dlsym(void *handle, const char *symbol) -{ - return dlsym(handle, symbol); -} - -static int vkd3d_dlclose(void *handle) -{ - return dlclose(handle); -} - -static const char *vkd3d_dlerror(void) -{ - return dlerror(); -} -#else -static void *vkd3d_dlopen(const char *name) -{ - FIXME("Not implemented for this platform.\n"); - return NULL; -} - -static void *vkd3d_dlsym(void *handle, const char *symbol) -{ - return NULL; -} - -static int vkd3d_dlclose(void *handle) -{ - return 0; -} - -static const char *vkd3d_dlerror(void) -{ - return "Not implemented for this platform.\n"; -} -#endif - struct vkd3d_struct { enum vkd3d_structure_type type;