From 40751cb4054230c84ca0fe023792b2ca1258b70a Mon Sep 17 00:00:00 2001 From: Luca Bacci Date: Thu, 17 Sep 2020 18:19:52 +0200 Subject: [PATCH 1/7] Add support for TLS callbacks on Windows --- glib/gconstructor.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/glib/gconstructor.h b/glib/gconstructor.h index 9509e595f5..0b4c798b83 100644 --- a/glib/gconstructor.h +++ b/glib/gconstructor.h @@ -25,12 +25,24 @@ #define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void); #define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void); +#ifdef G_OS_WIN32 + +#define G_HAS_TLS_CALLBACK 1 + +#define G_DEFINE_TLS_CALLBACK(_func) \ +static void NTAPI _func (PVOID, DWORD, PVOID); \ +static const PIMAGE_TLS_CALLBACK __attribute__((section(".CRT$XLE"))) \ +p_tls_callback ## _func = _func; + +#endif /* G_OS_WIN32 */ + #elif defined (_MSC_VER) && (_MSC_VER >= 1500) /* Visual studio 2008 and later has _Pragma */ #include #define G_HAS_CONSTRUCTORS 1 +#define G_HAS_TLS_CALLBACK 1 /* We do some weird things to avoid the constructors being optimized * away on VS2015 if WholeProgramOptimization is enabled. First we @@ -53,6 +65,7 @@ #define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX) #define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX) +#define G_DEFINE_TLS_CALLBACK(_func) G_MSVC_TLS_CALLBACK (_func, G_MSVC_SYMBOL_PREFIX) #define G_MSVC_CTOR(_func,_sym_prefix) \ static void _func(void); \ @@ -70,6 +83,14 @@ __pragma(section(".CRT$XCU",read)) \ __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor; +#define G_MSVC_TLS_CALLBACK(_func,_sym_prefix) \ + static void NTAPI _func (PVOID, DWORD, PVOID); \ + __pragma(section(".CRT$XLE",read)) \ + __pragma(comment(linker,"/include:" _sym_prefix "_tls_used")) \ + __pragma(comment(linker,"/include:" _sym_prefix "p_tls_callback" # _func)) \ + __declspec(allocate(".CRT$XLE")) \ + static const PIMAGE_TLS_CALLBACK p_tls_callback ## _func = _func; + #elif defined (_MSC_VER) #define G_HAS_CONSTRUCTORS 1 -- GitLab From 023b027477cafb952172e3da7d8d8f0f846f8cb1 Mon Sep 17 00:00:00 2001 From: Luca Bacci Date: Thu, 17 Sep 2020 19:09:24 +0200 Subject: [PATCH 2/7] Enable support for static builds on Windows using TLS callbacks --- glib/glib-init.c | 70 ++++++++++++++++++++++++++++++++++++++++++-- glib/gthread-win32.c | 8 +++++ gobject/gtype.c | 47 +++++++++++++++++++++++++++++ 3 files changed, 123 insertions(+), 2 deletions(-) diff --git a/glib/glib-init.c b/glib/glib-init.c index ed800dca13..ad0bd13acb 100644 --- a/glib/glib-init.c +++ b/glib/glib-init.c @@ -271,12 +271,14 @@ glib_init (void) #if defined (G_OS_WIN32) +HMODULE glib_dll; + +#ifdef DLL_EXPORT + BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved); -HMODULE glib_dll; - BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, @@ -318,6 +320,70 @@ DllMain (HINSTANCE hinstDLL, return TRUE; } +#else /* DLL_EXPORT */ + +#ifdef G_HAS_TLS_CALLBACK + +/* + When GLib is compiled statically we use a TLS callback for + initialization, finalization and thread-ending notification. + TLS callbacks are very much like DllMain, but are availbale + regardless if compiling a static or dynamic library. + If GLib is compiled statically, DllHandle will be the handle + of the containing DLL / EXE. +*/ + +#ifdef G_DEFINE_TLS_CALLBACK_NEEDS_PRAGMA +#pragma G_DEFINE_TLS_CALLBACK_PRAGMA_ARGS(GlibTlsCallback) +#endif +G_DEFINE_TLS_CALLBACK(GLibTlsCallback) + +static void NTAPI +GLibTlsCallback (PVOID hinstDLL, + DWORD Reason, + PVOID Reserved) +{ + switch (Reason) + { + case DLL_PROCESS_ATTACH: + glib_dll = hinstDLL; + g_crash_handler_win32_init (); + g_clock_win32_init (); +#ifdef THREADS_WIN32 + g_thread_win32_init (); +#endif + glib_init (); + /* must go after glib_init */ + g_console_win32_init (); + break; + + case DLL_THREAD_ATTACH: + break; + + case DLL_THREAD_DETACH: +#ifdef THREADS_WIN32 + g_thread_win32_thread_detach (); +#endif + break; + + case DLL_PROCESS_DETACH: +#ifdef THREADS_WIN32 + if (Reserved == NULL) + g_thread_win32_process_detach (); +#endif + g_crash_handler_win32_deinit (); + break; + } +} + +#else /* G_HAS_TLS_CALLBACK */ + +#error compiler is missing tls callback support + +#endif /* G_HAS_TLS_CALLBACK */ + +#endif /* GLIB_STATIC_COMPILATION */ + #elif defined (G_HAS_CONSTRUCTORS) #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA diff --git a/glib/gthread-win32.c b/glib/gthread-win32.c index 54f74f2f83..1fe370896e 100644 --- a/glib/gthread-win32.c +++ b/glib/gthread-win32.c @@ -606,6 +606,12 @@ g_system_thread_set_name (const gchar *name) void g_thread_win32_init (void) { + static gboolean threads_inited; + + if (threads_inited) + /* Already inited */ + return; + InitializeCriticalSection (&g_private_lock); #ifndef _MSC_VER @@ -615,6 +621,8 @@ g_thread_win32_init (void) /* This is bad, but what can we do? */ } #endif + + threads_inited = TRUE; } void diff --git a/gobject/gtype.c b/gobject/gtype.c index 723675d594..fd4c158d70 100644 --- a/gobject/gtype.c +++ b/gobject/gtype.c @@ -32,6 +32,7 @@ #include "gobject_trace.h" #include "glib-private.h" +#include "glib-init.h" #include "gconstructor.h" #ifdef G_OS_WIN32 @@ -4369,6 +4370,15 @@ gobject_init (void) TypeNode *node; GType type G_GNUC_UNUSED /* when compiling with G_DISABLE_ASSERT */; + /* In addition to glib-init.c, also init win32-specific threading/locking + * primitives right before we first make use of them. gconstructor.h does not + * guarantee the order in which constructors are called, but it's fine to call + * this multiple times since it'll be a no-op. Since gobject-2.0 needs + * glib-2.0, this will always be de-inited correctly. */ +#if defined (G_OS_WIN32) && defined (THREADS_WIN32) && !defined(DLL_EXPORT) + g_thread_win32_init (); +#endif /* G_OS_WIN32 && THREADS_WIN32 && !DLL_EXPORT */ + /* Ensure GLib is initialized first, see * https://bugzilla.gnome.org/show_bug.cgi?id=756139 */ @@ -4458,6 +4468,8 @@ gobject_init (void) #if defined (G_OS_WIN32) +#ifdef DLL_EXPORT + BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved); @@ -4481,6 +4493,41 @@ DllMain (HINSTANCE hinstDLL, return TRUE; } +#else /* DLL_EXPORT */ + +#ifdef G_HAS_TLS_CALLBACK + +/* + TLS callbacks are very much like DllMain, but are availbale + regardless if compiling a static or dynamic library. +*/ + +#ifdef G_DEFINE_TLS_CALLBACK_NEEDS_PRAGMA +#pragma G_DEFINE_TLS_CALLBACK_PRAGMA_ARGS(GlibTlsCallback) +#endif +G_DEFINE_TLS_CALLBACK(GLibTlsCallback) + +static void NTAPI +GLibTlsCallback (PVOID hinstDLL, + DWORD Reason, + PVOID Reserved) +{ + switch (Reason) + { + case DLL_PROCESS_ATTACH: + gobject_init (); + break; + + default: + /* do nothing */ + ; + } +} + +#endif /* G_HAS_TLS_CALLBACK */ + +#endif + #elif defined (G_HAS_CONSTRUCTORS) #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(gobject_init_ctor) -- GitLab From 51c588192050344665ece072bdfe422cbc0ec3e9 Mon Sep 17 00:00:00 2001 From: Luca Bacci Date: Fri, 18 Sep 2020 15:33:08 +0200 Subject: [PATCH 3/7] Add support for G_SPAWN_WIN32_HELPER_DIR environment variable --- glib/gspawn-win32.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/glib/gspawn-win32.c b/glib/gspawn-win32.c index e1ff7e0414..fe1eda31dc 100644 --- a/glib/gspawn-win32.c +++ b/glib/gspawn-win32.c @@ -560,7 +560,7 @@ do_spawn_with_fds (gint *exit_status, gint conv_error_index; gchar *helper_process; wchar_t *whelper, **wargv, **wenvp; - gchar *glib_dll_directory; + gchar *spawn_helper_directory; if (child_setup && !warned_about_child_setup) { @@ -597,12 +597,15 @@ do_spawn_with_fds (gint *exit_status, helper_process = HELPER_PROCESS "-console.exe"; else helper_process = HELPER_PROCESS ".exe"; - - glib_dll_directory = _glib_get_dll_directory (); - if (glib_dll_directory != NULL) + + spawn_helper_directory = g_strdup (g_getenv ("G_SPAWN_WIN32_HELPER_DIR")); + if (spawn_helper_directory == NULL) + spawn_helper_directory = _glib_get_dll_directory (); + + if (spawn_helper_directory != NULL) { - helper_process = g_build_filename (glib_dll_directory, helper_process, NULL); - g_free (glib_dll_directory); + helper_process = g_build_filename (spawn_helper_directory, helper_process, NULL); + g_free (spawn_helper_directory); } else helper_process = g_strdup (helper_process); -- GitLab From 0ed8efe0bc73e2c6aa5ba220f7c81956137080e7 Mon Sep 17 00:00:00 2001 From: Luca Bacci Date: Fri, 18 Sep 2020 17:38:18 +0200 Subject: [PATCH 4/7] Meson: set G_SPWAN_WIN32_HELPER_DIR envvar for tests if compiling statically for Windows --- gio/tests/meson.build | 5 +++++ glib/meson.build | 16 ++++++++++++---- glib/tests/meson.build | 5 +++++ gobject/tests/meson.build | 5 +++++ tests/meson.build | 5 +++++ 5 files changed, 32 insertions(+), 4 deletions(-) diff --git a/gio/tests/meson.build b/gio/tests/meson.build index d8ebd56acf..cde40d25f4 100644 --- a/gio/tests/meson.build +++ b/gio/tests/meson.build @@ -1,3 +1,5 @@ +fs = import('fs') + common_gio_tests_deps = [ libglib_dep, libgmodule_dep, @@ -97,6 +99,9 @@ test_env = environment() test_env.set('G_TEST_SRCDIR', meson.current_source_dir()) test_env.set('G_TEST_BUILDDIR', meson.current_build_dir()) test_env.set('GIO_MODULE_DIR', '') +if host_system == 'windows' and get_option('default_library') == 'static' + test_env.set('G_SPAWN_WIN32_HELPER_DIR', fs.parent(gspawn_win32_helper.full_path())) +endif # Check for libdbus1 - Optional - is only used in the GDBus test cases # 1.2.14 required for dbus_message_set_serial diff --git a/glib/meson.build b/glib/meson.build index 7e0edb9058..abbf34d3a8 100644 --- a/glib/meson.build +++ b/glib/meson.build @@ -409,23 +409,31 @@ endif # On Windows, glib needs a spawn helper for g_spawn* API if host_system == 'windows' if host_machine.cpu_family() == 'x86' - executable('gspawn-win32-helper', 'gspawn-win32-helper.c', + gspawn_win32_helper = executable( + 'gspawn-win32-helper', + 'gspawn-win32-helper.c', install : true, gui_app : true, include_directories : configinc, dependencies : [libglib_dep]) - executable('gspawn-win32-helper-console', 'gspawn-win32-helper.c', + gspawn_win32_helper_console = executable( + 'gspawn-win32-helper-console', + 'gspawn-win32-helper.c', install : true, c_args : ['-DHELPER_CONSOLE'], include_directories : configinc, dependencies : [libglib_dep]) else - executable('gspawn-win64-helper', 'gspawn-win32-helper.c', + gspawn_win32_helper = executable( + 'gspawn-win64-helper', + 'gspawn-win32-helper.c', install : true, gui_app : true, include_directories : configinc, dependencies : [libglib_dep]) - executable('gspawn-win64-helper-console', 'gspawn-win32-helper.c', + gspawn_win32_helper_console = executable( + 'gspawn-win64-helper-console', + 'gspawn-win32-helper.c', install : true, c_args : ['-DHELPER_CONSOLE'], include_directories : configinc, diff --git a/glib/tests/meson.build b/glib/tests/meson.build index 6eb23e8a77..842677a9dc 100644 --- a/glib/tests/meson.build +++ b/glib/tests/meson.build @@ -1,3 +1,5 @@ +fs = import('fs') + glib_tests = { 'array-test' : {}, 'asyncqueue' : {}, @@ -201,6 +203,9 @@ test_env.set('G_TEST_BUILDDIR', meson.current_build_dir()) test_env.set('G_DEBUG', 'gc-friendly') test_env.set('MALLOC_CHECK_', '2') test_env.set('MALLOC_PERTURB_', '@0@'.format(random_number % 256)) +if host_system == 'windows' and get_option('default_library') == 'static' + test_env.set('G_SPAWN_WIN32_HELPER_DIR', fs.parent(gspawn_win32_helper.full_path())) +endif test_deps = [libm, thread_dep, libglib_dep] test_cargs = ['-DG_LOG_DOMAIN="GLib"', '-UG_DISABLE_ASSERT'] diff --git a/gobject/tests/meson.build b/gobject/tests/meson.build index 8837f1a659..34e067a6e9 100644 --- a/gobject/tests/meson.build +++ b/gobject/tests/meson.build @@ -1,3 +1,5 @@ +fs = import('fs') + marshalers_h = custom_target('marshalers_h', output : 'marshalers.h', input : 'marshalers.list', @@ -72,6 +74,9 @@ test_env.set('G_TEST_BUILDDIR', meson.current_build_dir()) test_env.set('G_DEBUG', 'gc-friendly') test_env.set('MALLOC_CHECK_', '2') test_env.set('MALLOC_PERTURB_', '@0@'.format(random_number % 256)) +if host_system == 'windows' and get_option('default_library') == 'static' + test_env.set('G_SPAWN_WIN32_HELPER_DIR', fs.parent(gspawn_win32_helper.full_path())) +endif test_deps = [libm, thread_dep, libglib_dep, libgobject_dep] test_cargs = ['-DG_LOG_DOMAIN="GLib-GObject"', '-UG_DISABLE_ASSERT'] diff --git a/tests/meson.build b/tests/meson.build index 6741f8f522..0ad869768a 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -1,3 +1,5 @@ +fs = import('fs') + # tests # Not entirely random of course, but at least it changes over time @@ -9,6 +11,9 @@ test_env.set('G_TEST_BUILDDIR', meson.current_build_dir()) test_env.set('G_DEBUG', 'gc-friendly') test_env.set('MALLOC_CHECK_', '2') test_env.set('MALLOC_PERTURB_', '@0@'.format(random_number % 256)) +if host_system == 'windows' and get_option('default_library') == 'static' + test_env.set('G_SPAWN_WIN32_HELPER_DIR', fs.parent(gspawn_win32_helper.full_path())) +endif test_cargs = ['-DG_LOG_DOMAIN="GLib"', '-UG_DISABLE_ASSERT'] -- GitLab From 980c5d43f107a157cec6b000a99865099d2b75f4 Mon Sep 17 00:00:00 2001 From: Luca Bacci Date: Fri, 18 Sep 2020 20:42:38 +0200 Subject: [PATCH 5/7] Meson: Make gspawn-win32-helper program available to generators if compiling statically for Windows --- gio/copy.py | 3 +++ gio/meson.build | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 gio/copy.py diff --git a/gio/copy.py b/gio/copy.py new file mode 100644 index 0000000000..013400ff75 --- /dev/null +++ b/gio/copy.py @@ -0,0 +1,3 @@ +#!/usr/bin/env python3 +import sys, shutil +shutil.copy(sys.argv[1], sys.argv[2]) diff --git a/gio/meson.build b/gio/meson.build index 40a9ca6d03..a93faaf94c 100644 --- a/gio/meson.build +++ b/gio/meson.build @@ -1,3 +1,5 @@ +fs = import('fs') + gio_c_args = [ '-DG_LOG_DOMAIN="GLib-GIO"', '-DGIO_COMPILATION', @@ -224,6 +226,25 @@ gdbus_sources = files( 'gtestdbus.c', ) +#FIXME: https://github.com/mesonbuild/meson/issues/541 +if host_system == 'windows' and get_option('default_library') == 'static' + copy = find_program('copy.py') + copy_gspawn_win32_helper = custom_target( + 'copy-gspawn-win32-helper', + input: gspawn_win32_helper, + output: fs.name(gspawn_win32_helper.full_path()), + command: [copy, '@INPUT@', '@OUTPUT@'], + build_by_default: true, + ) + copy_gspawn_win32_helper_console = custom_target( + 'copy-gspawn-win32-helper-console', + input: gspawn_win32_helper_console, + output: fs.name(gspawn_win32_helper_console.full_path()), + command: [copy, '@INPUT@', '@OUTPUT@'], + build_by_default: true, + ) +endif + # Generate gdbus-codegen subdir('gdbus-2.0/codegen') -- GitLab From 66c830f3031e599c179408bf0180ed3cb800ddb8 Mon Sep 17 00:00:00 2001 From: Luca Bacci Date: Sat, 19 Sep 2020 10:05:33 +0200 Subject: [PATCH 6/7] Fix GIOModule for MSVC --- gio/tests/modules/symbol-visibility.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gio/tests/modules/symbol-visibility.h b/gio/tests/modules/symbol-visibility.h index f9f8826ce9..f66e7eaedb 100644 --- a/gio/tests/modules/symbol-visibility.h +++ b/gio/tests/modules/symbol-visibility.h @@ -2,9 +2,9 @@ #define GLIB_TEST_SYMBOL_VISIBILITY /* This is the same check that's done in configure to create config.h */ -#ifdef _WIN32 +#if defined(_WIN32) # ifdef _MSC_VER -# define GLIB_TEST_EXPORT_SYMBOL __declspec(dllexport) extern +# define GLIB_TEST_EXPORT_SYMBOL __declspec(dllexport) # else # define GLIB_TEST_EXPORT_SYMBOL __attribute__((visibility("default"))) __declspec(dllexport) extern # endif -- GitLab From 520339279ccb49586a77f935df7d0fe43a65b37a Mon Sep 17 00:00:00 2001 From: Luca Bacci Date: Sat, 19 Sep 2020 23:49:14 +0200 Subject: [PATCH 7/7] Fixes --- gio/tests/meson.build | 3 +-- gio/tests/modules/symbol-visibility.h | 3 ++- glib/gconstructor.h | 3 ++- glib/meson.build | 10 +++++++++- glib/tests/meson.build | 3 +-- gobject/gtype.c | 10 +++++----- gobject/tests/meson.build | 3 +-- 7 files changed, 21 insertions(+), 14 deletions(-) diff --git a/gio/tests/meson.build b/gio/tests/meson.build index cde40d25f4..f75265557c 100644 --- a/gio/tests/meson.build +++ b/gio/tests/meson.build @@ -1,5 +1,3 @@ -fs = import('fs') - common_gio_tests_deps = [ libglib_dep, libgmodule_dep, @@ -100,6 +98,7 @@ test_env.set('G_TEST_SRCDIR', meson.current_source_dir()) test_env.set('G_TEST_BUILDDIR', meson.current_build_dir()) test_env.set('GIO_MODULE_DIR', '') if host_system == 'windows' and get_option('default_library') == 'static' + fs = import('fs') test_env.set('G_SPAWN_WIN32_HELPER_DIR', fs.parent(gspawn_win32_helper.full_path())) endif diff --git a/gio/tests/modules/symbol-visibility.h b/gio/tests/modules/symbol-visibility.h index f66e7eaedb..e760807442 100644 --- a/gio/tests/modules/symbol-visibility.h +++ b/gio/tests/modules/symbol-visibility.h @@ -4,7 +4,8 @@ /* This is the same check that's done in configure to create config.h */ #if defined(_WIN32) # ifdef _MSC_VER -# define GLIB_TEST_EXPORT_SYMBOL __declspec(dllexport) +/*# define GLIB_TEST_EXPORT_SYMBOL __declspec(dllexport) extern*/ +# define GLIB_TEST_EXPORT_SYMBOL # else # define GLIB_TEST_EXPORT_SYMBOL __attribute__((visibility("default"))) __declspec(dllexport) extern # endif diff --git a/glib/gconstructor.h b/glib/gconstructor.h index 0b4c798b83..3410ffaf1b 100644 --- a/glib/gconstructor.h +++ b/glib/gconstructor.h @@ -85,11 +85,12 @@ p_tls_callback ## _func = _func; #define G_MSVC_TLS_CALLBACK(_func,_sym_prefix) \ static void NTAPI _func (PVOID, DWORD, PVOID); \ + extern const PIMAGE_TLS_CALLBACK p_tls_callback ## _func; \ __pragma(section(".CRT$XLE",read)) \ __pragma(comment(linker,"/include:" _sym_prefix "_tls_used")) \ __pragma(comment(linker,"/include:" _sym_prefix "p_tls_callback" # _func)) \ __declspec(allocate(".CRT$XLE")) \ - static const PIMAGE_TLS_CALLBACK p_tls_callback ## _func = _func; + const PIMAGE_TLS_CALLBACK p_tls_callback ## _func = _func; #elif defined (_MSC_VER) diff --git a/glib/meson.build b/glib/meson.build index abbf34d3a8..4a6a08ede9 100644 --- a/glib/meson.build +++ b/glib/meson.build @@ -363,7 +363,14 @@ else pcre_objects = [libpcre.extract_all_objects()] endif -glib_c_args = ['-DG_LOG_DOMAIN="GLib"', '-DGLIB_COMPILATION'] + pcre_static_args + glib_hidden_visibility_args +#TODO should be used only if using libintl-proxy +intl_static_args = [] + +if get_option('default_library') == 'static' + intl_static_args = ['-DG_INTL_STATIC_COMPILATION'] +endif + +glib_c_args = ['-DG_LOG_DOMAIN="GLib"', '-DGLIB_COMPILATION'] + pcre_static_args + intl_static_args + glib_hidden_visibility_args libglib = library('glib-2.0', glib_dtrace_obj, glib_dtrace_hdr, sources : [deprecated_sources, glib_sources], @@ -383,6 +390,7 @@ libglib = library('glib-2.0', libglib_dep = declare_dependency( link_with : libglib, dependencies : libintl_deps, + compile_args: intl_static_args, # We sadly need to export configinc here because everyone includes include_directories : [configinc, glibinc]) diff --git a/glib/tests/meson.build b/glib/tests/meson.build index 842677a9dc..842e2a6d83 100644 --- a/glib/tests/meson.build +++ b/glib/tests/meson.build @@ -1,5 +1,3 @@ -fs = import('fs') - glib_tests = { 'array-test' : {}, 'asyncqueue' : {}, @@ -204,6 +202,7 @@ test_env.set('G_DEBUG', 'gc-friendly') test_env.set('MALLOC_CHECK_', '2') test_env.set('MALLOC_PERTURB_', '@0@'.format(random_number % 256)) if host_system == 'windows' and get_option('default_library') == 'static' + fs = import('fs') test_env.set('G_SPAWN_WIN32_HELPER_DIR', fs.parent(gspawn_win32_helper.full_path())) endif diff --git a/gobject/gtype.c b/gobject/gtype.c index fd4c158d70..12e7cdecaa 100644 --- a/gobject/gtype.c +++ b/gobject/gtype.c @@ -4503,14 +4503,14 @@ DllMain (HINSTANCE hinstDLL, */ #ifdef G_DEFINE_TLS_CALLBACK_NEEDS_PRAGMA -#pragma G_DEFINE_TLS_CALLBACK_PRAGMA_ARGS(GlibTlsCallback) +#pragma G_DEFINE_TLS_CALLBACK_PRAGMA_ARGS(GObjectTlsCallback) #endif -G_DEFINE_TLS_CALLBACK(GLibTlsCallback) +G_DEFINE_TLS_CALLBACK(GObjectTlsCallback) static void NTAPI -GLibTlsCallback (PVOID hinstDLL, - DWORD Reason, - PVOID Reserved) +GObjectTlsCallback (PVOID hinstDLL, + DWORD Reason, + PVOID Reserved) { switch (Reason) { diff --git a/gobject/tests/meson.build b/gobject/tests/meson.build index 34e067a6e9..a08129f285 100644 --- a/gobject/tests/meson.build +++ b/gobject/tests/meson.build @@ -1,5 +1,3 @@ -fs = import('fs') - marshalers_h = custom_target('marshalers_h', output : 'marshalers.h', input : 'marshalers.list', @@ -75,6 +73,7 @@ test_env.set('G_DEBUG', 'gc-friendly') test_env.set('MALLOC_CHECK_', '2') test_env.set('MALLOC_PERTURB_', '@0@'.format(random_number % 256)) if host_system == 'windows' and get_option('default_library') == 'static' + fs = import('fs') test_env.set('G_SPAWN_WIN32_HELPER_DIR', fs.parent(gspawn_win32_helper.full_path())) endif -- GitLab