This file is part of MXE. See LICENSE.md for licensing information. Contains ad hoc patches for cross building. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Sat, 12 Nov 2022 14:49:04 +0100 Subject: [PATCH 1/1] giomodule: allow to be statically linked against GLib i.e. when GLib and/or GObject is build as a shared library. Upstream-Status: Pending diff --git a/gio/giomodule.c b/gio/giomodule.c index 1111111..2222222 100644 --- a/gio/giomodule.c +++ b/gio/giomodule.c @@ -1123,7 +1123,7 @@ extern GType _g_win32_network_monitor_get_type (void); static HMODULE gio_dll = NULL; -#ifndef GLIB_STATIC_COMPILATION +#ifndef GIO_STATIC_COMPILATION BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, @@ -1143,9 +1143,13 @@ DllMain (HINSTANCE hinstDLL, return TRUE; } -#elif defined(G_HAS_CONSTRUCTORS) /* && G_PLATFORM_WIN32 && GLIB_STATIC_COMPILATION */ +#elif defined(G_HAS_CONSTRUCTORS) /* && G_PLATFORM_WIN32 && GIO_STATIC_COMPILATION */ +#ifdef GLIB_STATIC_COMPILATION extern void glib_win32_init (void); +#endif /* GLIB_STATIC_COMPILATION */ +#ifdef GOBJECT_STATIC_COMPILATION extern void gobject_win32_init (void); +#endif /* GOBJECT_STATIC_COMPILATION */ #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(giomodule_init_ctor) @@ -1168,14 +1172,18 @@ giomodule_init_ctor (void) * In this case, we must ensure explicitly that glib and gobject are always * well initialized BEFORE gio. */ +#ifdef GLIB_STATIC_COMPILATION glib_win32_init (); +#endif /* GLIB_STATIC_COMPILATION */ +#ifdef GOBJECT_STATIC_COMPILATION gobject_win32_init (); +#endif /* GOBJECT_STATIC_COMPILATION */ gio_win32_appinfo_init (FALSE); } -#else /* G_PLATFORM_WIN32 && GLIB_STATIC_COMPILATION && !G_HAS_CONSTRUCTORS */ +#else /* G_PLATFORM_WIN32 && GIO_STATIC_COMPILATION && !G_HAS_CONSTRUCTORS */ #error Your platform/compiler is missing constructor support -#endif /* GLIB_STATIC_COMPILATION */ +#endif /* GIO_STATIC_COMPILATION */ void * _g_io_win32_get_module (void)