Makefile.am gmodule.def Win32 DLL ABI stability cruft like in ../glib.
authorTor Lillqvist <tml@iki.fi>
Mon, 6 Dec 2004 15:45:25 +0000 (15:45 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Mon, 6 Dec 2004 15:45:25 +0000 (15:45 +0000)
2004-12-06  Tor Lillqvist  <tml@iki.fi>

* Makefile.am
* gmodule.def
* gmodule.[hc]: Win32 DLL ABI stability cruft like in ../glib.

gmodule/ChangeLog
gmodule/Makefile.am
gmodule/gmodule.c
gmodule/gmodule.def
gmodule/gmodule.h

index c1821e9..b3ec3bf 100644 (file)
@@ -1,3 +1,9 @@
+2004-12-06  Tor Lillqvist  <tml@iki.fi>
+
+       * Makefile.am
+       * gmodule.def
+       * gmodule.[hc]: Win32 DLL ABI stability cruft like in ../glib.
+
 2004-12-02  Matthias Clasen  <mclasen@redhat.com>
 
        * === Released 2.5.7 ===
index 58fffda..8d43225 100644 (file)
@@ -55,6 +55,11 @@ if OS_WIN32
 export_symbols = -export-symbols $(srcdir)/gmodule.def
 
 install-libtool-import-lib:
+#      Don't put the binary compatibility entries in the import lib!
+       for entry in `grep PRIVATE gmodule.def | sed -e 's/PRIVATE//'`; do \
+         file=`nm -A .libs/libgmodule-2.0.dll.a | tr -d '\r' | grep -m 1 -E $$entry'$$' | cut -d: -f2`; \
+         ar d .libs/libgmodule-2.0.dll.a $$file; \
+       done
        $(INSTALL) .libs/libgmodule-2.0.dll.a $(DESTDIR)$(libdir)
        $(INSTALL) $(srcdir)/gmodule.def $(DESTDIR)$(libdir)/gmodule-2.0.def
 
index 1673b2e..2f72d1e 100644 (file)
@@ -59,6 +59,9 @@
 struct _GModule
 {
   gchar        *file_name;
+#ifdef G_OS_WIN32
+  gchar *cp_file_name;
+#endif
   gpointer handle;
   guint ref_count : 31;
   guint is_resident : 1;
@@ -318,6 +321,9 @@ g_module_open (const gchar    *file_name,
            {
              main_module = g_new (GModule, 1);
              main_module->file_name = NULL;
+#ifdef G_OS_WIN32
+             main_module->cp_file_name = NULL;
+#endif
              main_module->handle = handle;
              main_module->ref_count = 1;
              main_module->is_resident = TRUE;
@@ -427,6 +433,10 @@ g_module_open (const gchar    *file_name,
       
       module = g_new (GModule, 1);
       module->file_name = g_strdup (file_name);
+#ifdef G_OS_WIN32
+      module->cp_file_name = g_locale_from_utf8 (file_name, -1,
+                                                NULL, NULL, NULL);
+#endif
       module->handle = handle;
       module->ref_count = 1;
       module->is_resident = FALSE;
@@ -462,6 +472,24 @@ g_module_open (const gchar    *file_name,
   return module;
 }
 
+#ifdef G_OS_WIN32
+
+#undef g_module_open
+
+GModule*
+g_module_open (const gchar    *file_name,
+              GModuleFlags    flags)
+{
+  gchar *utf8_file_name = g_locale_to_utf8 (file_name, -1, NULL, NULL, NULL);
+  GModule *retval = g_module_open_utf8 (utf8_file_name, flags);
+
+  g_free (utf8_file_name);
+
+  return retval;
+}
+
+#endif
+
 gboolean
 g_module_close (GModule               *module)
 {
@@ -508,7 +536,9 @@ g_module_close (GModule            *module)
       
       _g_module_close (module->handle, FALSE);
       g_free (module->file_name);
-      
+#ifdef G_OS_WIN32
+      g_free (module->cp_file_name);
+#endif
       g_free (module);
     }
   
@@ -585,6 +615,23 @@ g_module_name (GModule *module)
   return module->file_name;
 }
 
+#ifdef G_OS_WIN32
+
+#undef g_module_name
+
+G_CONST_RETURN gchar*
+g_module_name (GModule *module)
+{
+  g_return_val_if_fail (module != NULL, NULL);
+  
+  if (module == main_module)
+    return "main";
+  
+  return module->cp_file_name;
+}
+
+#endif
+
 gchar*
 g_module_build_path (const gchar *directory,
                     const gchar *module_name)
index 11e0d5d..ef202a9 100644 (file)
@@ -3,7 +3,9 @@ EXPORTS
        g_module_close
        g_module_error
        g_module_make_resident
-       g_module_name
-       g_module_open
+       g_module_name PRIVATE
+       g_module_name_utf8
+       g_module_open PRIVATE
+       g_module_open_utf8
        g_module_supported
        g_module_symbol
index 75de322..ae7f8e5 100644 (file)
@@ -52,6 +52,11 @@ typedef      struct _GModule                  GModule;
 typedef const gchar* (*GModuleCheckInit) (GModule      *module);
 typedef void        (*GModuleUnload)    (GModule       *module);
 
+#ifdef G_OS_WIN32
+#define g_module_open g_module_open_utf8
+#define g_module_name g_module_name_utf8
+#endif
+
 /* return TRUE if dynamic module loading is supported */
 gboolean       g_module_supported         (void) G_GNUC_CONST;