diff options
Diffstat (limited to 'gmodule')
-rw-r--r-- | gmodule/gmodule-win32.c | 12 | ||||
-rw-r--r-- | gmodule/meson.build | 25 |
2 files changed, 8 insertions, 29 deletions
diff --git a/gmodule/gmodule-win32.c b/gmodule/gmodule-win32.c index 1c7226a68..795dc0938 100644 --- a/gmodule/gmodule-win32.c +++ b/gmodule/gmodule-win32.c @@ -39,12 +39,6 @@ #include <sys/cygwin.h> #endif -/* Default family is DESKTOP_APP which is DESKTOP | APP - * We want to know when we're only building for apps */ -#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) -#define G_WINAPI_ONLY_APP -#endif - static void set_error (const gchar *format, ...) @@ -133,8 +127,11 @@ find_in_any_module_using_toolhelp (const gchar *symbol_name) HANDLE snapshot; MODULEENTRY32 me32; - gpointer p; + gpointer p = NULL; + /* Under UWP, Module32Next and Module32First are not available since we're + * not allowed to search in the address space of arbitrary loaded DLLs */ +#if !defined(G_WINAPI_ONLY_APP) if ((snapshot = CreateToolhelp32Snapshot (TH32CS_SNAPMODULE, 0)) == (HANDLE) -1) return NULL; @@ -149,6 +146,7 @@ find_in_any_module_using_toolhelp (const gchar *symbol_name) } CloseHandle (snapshot); +#endif return p; } diff --git a/gmodule/meson.build b/gmodule/meson.build index 942f9af3c..d38ad2df1 100644 --- a/gmodule/meson.build +++ b/gmodule/meson.build @@ -4,23 +4,8 @@ g_module_need_uscore = 0 g_module_broken_rtld_global = 0 g_module_have_dlerror = 0 -libdl_dep = [ ] -g_module_lib_args = [ ] g_module_impl = '' -dlopen_dlsym_test_code = ''' -#include <dlfcn.h> -int glib_underscore_test (void) { return 42; } -int main (int argc, char ** argv) { - void *f1 = (void*)0, *f2 = (void*)0, *handle; - handle = dlopen ((void*)0, 0); - if (handle) { - f1 = dlsym (handle, "glib_underscore_test"); - f2 = dlsym (handle, "_glib_underscore_test"); - } - return (!f2 || f1); -}''' - # On Windows force native WIN32 shared lib loader if host_system == 'windows' g_module_impl = 'G_MODULE_IMPL_WIN32' @@ -28,16 +13,12 @@ if host_system == 'windows' # dlopen() filepath must be of the form /path/libname.a(libname.so) elif host_system == 'aix' g_module_impl = 'G_MODULE_IMPL_AR' -elif cc.links(dlopen_dlsym_test_code, name : 'dlopen() and dlsym() in system libraries') - g_module_impl = 'G_MODULE_IMPL_DL' # NSLinkModule (dyld) in system libraries (Darwin) elif cc.has_function('NSLinkModule') g_module_impl = 'G_MODULE_IMPL_DYLD' g_module_need_uscore = 1 -elif cc.links(dlopen_dlsym_test_code, args : '-ldl', name : 'dlopen() and dlsym() in libdl') +elif have_dlopen_dlsym g_module_impl = 'G_MODULE_IMPL_DL' - libdl_dep = cc.find_library('dl') - g_module_lib_args = '-ldl' endif # additional checks for G_MODULE_IMPL_DL @@ -51,7 +32,7 @@ if g_module_impl == 'G_MODULE_IMPL_DL' elif meson.has_exe_wrapper() # FIXME: communicate result via stdout instead of return value, so non-0 return is not printed in bold red rres = cc.run(dlopen_dlsym_test_code, - args : g_module_lib_args, + dependencies : libdl_dep, name : 'dlsym() preceding underscores') if host_system == 'windows' or rres.returncode() == 0 g_module_need_uscore = 1 @@ -61,7 +42,7 @@ if g_module_impl == 'G_MODULE_IMPL_DL' g_module_need_uscore = 0 endif - if cc.has_function('dlerror', args : g_module_lib_args) + if cc.has_function('dlerror', dependencies : libdl_dep) g_module_have_dlerror = 1 endif endif |