Prefer the use of GCC constructors over DllMain

This removes the DllMain symbol from the static libraries
This commit is contained in:
Erik van Pienbroek 2013-03-23 14:28:07 +01:00
parent 9a8031694f
commit fba82fe33f
2 changed files with 60 additions and 0 deletions

View File

@ -0,0 +1,52 @@
--- glib/glib-init.c.orig 2013-03-23 12:07:27.009718160 +0100
+++ glib/glib-init.c 2013-03-23 13:00:24.460030271 +0100
@@ -223,12 +223,14 @@
#if defined (G_OS_WIN32)
+HMODULE glib_dll = NULL;
+
+#if defined (DLL_EXPORT)
+
BOOL WINAPI DllMain (HINSTANCE hinstDLL,
DWORD fdwReason,
LPVOID lpvReserved);
-HMODULE glib_dll;
-
BOOL WINAPI
DllMain (HINSTANCE hinstDLL,
DWORD fdwReason,
@@ -238,9 +240,6 @@
{
case DLL_PROCESS_ATTACH:
glib_dll = hinstDLL;
- g_clock_win32_init ();
- g_thread_win32_init ();
- glib_init ();
break;
case DLL_THREAD_DETACH:
@@ -255,7 +254,10 @@
return TRUE;
}
-#elif defined (G_HAS_CONSTRUCTORS)
+#endif /* defined (DLL_EXPORT) */
+#endif /* defined (G_OS_WIN32) */
+
+#if defined (G_HAS_CONSTRUCTORS)
#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(glib_init_ctor)
@@ -265,6 +267,10 @@
static void
glib_init_ctor (void)
{
+#if defined (G_OS_WIN32)
+ g_clock_win32_init ();
+ g_thread_win32_init ();
+#endif
glib_init ();
}

View File

@ -58,6 +58,11 @@ Patch3: glib-send-log-messages-to-correct-stdout-and-stderr.patch
# https://bugzilla.gnome.org/show_bug.cgi?id=694506
Patch4: glib-formatstring.patch
# Prefer the use of GCC constructors over DllMain
# This prevents having to depend on DllMain in static libraries
# http://lists.fedoraproject.org/pipermail/fedora-mingw/2013-March/006429.html
Patch5: glib-prefer-constructors-over-DllMain.patch
%description
MinGW Windows Glib2 library.
@ -104,6 +109,7 @@ Static version of the MinGW Windows GLib2 library.
%patch2 -p1
%patch3 -p0
%patch4 -p0
%patch5 -p0
autoreconf -i --force
@ -287,6 +293,8 @@ find $RPM_BUILD_ROOT -name "*.la" -delete
* Sat Mar 23 2013 Erik van Pienbroek <epienbro@fedoraproject.org> - 2.35.9-1
- Update to 2.35.9
- Added R: mingw{32,64}-gettext-static to the -static subpackages
- Prefer the use of GCC constructors over DllMain
This removes the DllMain symbol from the static libraries
* Fri Feb 22 2013 Thomas Sailer <t.sailer@alumni.ethz.ch> - 2.35.8-1
- update to 2.35.8