| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 
 | # 补丁0001-win32-Prefer-the-use-of-constructors-over-DllMain.patch内容如下:From bc90511c1eb333e26e0bc0eaee62375d0e788db6 Mon Sep 17 00:00:00 2001
 From: Erik van Pienbroek <epienbro@fedoraproject.org>
 Date: Tue, 16 Apr 2013 11:42:11 +0200
 Subject: [PATCH] win32: Prefer the use of constructors over DllMain
 
 This prevents having to depend on DllMain in static libraries
 
 Constructors are available in both the GCC build (GCC 2.7 and later)
 and the MSVC build (MSVC 2008 and later using _Pragma, earlier
 versions using #pragma)
 
 glib/glib-init.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)
 
 
 
 
 
 @@ -223,12 +223,14 @@ glib_init (void)
 
 #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,11 +240,6 @@ DllMain (HINSTANCE hinstDLL,
 {
 case DLL_PROCESS_ATTACH:
 glib_dll = hinstDLL;
 -      g_clock_win32_init ();
 -#ifdef THREADS_WIN32
 -      g_thread_win32_init ();
 -#endif
 -      glib_init ();
 break;
 
 case DLL_THREAD_DETACH:
 @@ -259,7 +256,10 @@ DllMain (HINSTANCE hinstDLL,
 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)
 @@ -269,6 +269,12 @@ G_DEFINE_CONSTRUCTOR(glib_init_ctor)
 static void
 glib_init_ctor (void)
 {
 +#if defined (G_OS_WIN32)
 +  g_clock_win32_init ();
 +#ifdef THREADS_WIN32
 +  g_thread_win32_init ();
 +#endif /* defined (THREADS_WIN32) */
 +#endif /* defined (G_OS_WIN32) */
 glib_init ();
 }
 
 --
 1.8.2
 
 
 |