[glib] win32: Fix GDBusDaemon build when glib is built as a static lib



commit 80c24d36f2525d83e458ebbdf62fdbd085945a02
Author: Kalev Lember <kalevlember gmail com>
Date:   Sun Dec 2 15:34:37 2012 +0100

    win32: Fix GDBusDaemon build when glib is built as a static lib
    
    This makes sure not to ifdef _g_io_win32_get_module() out when glib is
    built as a static lib, and also fixes it to work when DllMain isn't
    available.
    
    The implementation uses GetModuleHandleEx() which is only available on
    Windows XP and later, so this commit effectively drops the Windows 2000
    support in glib. Earlier commit 731b4699 already took care of defining
    _WIN32_WINNT to support the Windows XP API.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=675516

 gio/giomodule.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/gio/giomodule.c b/gio/giomodule.c
index e7ba040..74b29aa 100644
--- a/gio/giomodule.c
+++ b/gio/giomodule.c
@@ -801,14 +801,18 @@ DllMain (HINSTANCE hinstDLL,
   return TRUE;
 }
 
+#endif
+
 void *
 _g_io_win32_get_module (void)
 {
+  if (!gio_dll)
+    GetModuleHandleExA (GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
+                        (const char *) _g_io_win32_get_module,
+                        &gio_dll);
   return gio_dll;
 }
 
-#endif
-
 #undef GIO_MODULE_DIR
 
 /* GIO_MODULE_DIR is used only in code called just once,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]