diff --git a/gmodule/ChangeLog b/gmodule/ChangeLog index c1821e952..b3ec3bfc9 100644 --- a/gmodule/ChangeLog +++ b/gmodule/ChangeLog @@ -1,3 +1,9 @@ +2004-12-06 Tor Lillqvist + + * Makefile.am + * gmodule.def + * gmodule.[hc]: Win32 DLL ABI stability cruft like in ../glib. + 2004-12-02 Matthias Clasen * === Released 2.5.7 === diff --git a/gmodule/Makefile.am b/gmodule/Makefile.am index 58fffda8c..8d43225e1 100644 --- a/gmodule/Makefile.am +++ b/gmodule/Makefile.am @@ -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 diff --git a/gmodule/gmodule.c b/gmodule/gmodule.c index 1673b2e6e..2f72d1e34 100644 --- a/gmodule/gmodule.c +++ b/gmodule/gmodule.c @@ -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) diff --git a/gmodule/gmodule.def b/gmodule/gmodule.def index 11e0d5da3..ef202a947 100644 --- a/gmodule/gmodule.def +++ b/gmodule/gmodule.def @@ -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 diff --git a/gmodule/gmodule.h b/gmodule/gmodule.h index 75de322cb..ae7f8e54a 100644 --- a/gmodule/gmodule.h +++ b/gmodule/gmodule.h @@ -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;