From 8dd860987015d6be46bccab82ba00f03140f0396 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Fri, 9 Mar 2001 21:33:23 +0000 Subject: [PATCH] Use G_BEGIN_DECLS and G_END_DECLS. Define G_MODULE_EXPORT correctly on 2001-02-21 Tor Lillqvist * gmodule.h: Use G_BEGIN_DECLS and G_END_DECLS. Define G_MODULE_EXPORT correctly on Cygwin, too. * gmodule-win32.c (_g_module_open): Convert path to Windows format on Cygwin. * Makefile.am (libglib): Use libglib-1.3.la from top_builddir. Invoke libtool with -no-undefined for Win32 and Cygwin. --- gmodule/ChangeLog | 12 ++++++++++++ gmodule/Makefile.am | 23 +++++++++++++++-------- gmodule/gmodule-win32.c | 10 ++++++++++ gmodule/gmodule.h | 15 +++++---------- 4 files changed, 42 insertions(+), 18 deletions(-) diff --git a/gmodule/ChangeLog b/gmodule/ChangeLog index ad2b3259d..bd8021e12 100644 --- a/gmodule/ChangeLog +++ b/gmodule/ChangeLog @@ -5,6 +5,18 @@ * gmodule.def, gmodule.h, gmodule.c: Removed g_log_domain_gmodule. +2001-02-21 Tor Lillqvist + + * gmodule.h: Use G_BEGIN_DECLS and G_END_DECLS. Define + G_MODULE_EXPORT correctly on Cygwin, too. + + * gmodule-win32.c (_g_module_open): Convert path to Windows format + on Cygwin. + + * Makefile.am (libglib): Use libglib-1.3.la from + top_builddir. Invoke libtool with -no-undefined for Win32 and + Cygwin. + 2001-02-17 Havoc Pennington Applied patch from Soeren Sandmann: diff --git a/gmodule/Makefile.am b/gmodule/Makefile.am index 7bac888a1..19ad51d59 100644 --- a/gmodule/Makefile.am +++ b/gmodule/Makefile.am @@ -28,29 +28,36 @@ glibincludedir=$(includedir)/glib-2.0 glibinclude_HEADERS = \ gmodule.h -libglib = $(top_builddir)/libglib-1.3.la # -lglib +libglib = $(top_builddir)/libglib-1.3.la top_builddir_full=`cd \$(top_builddir); pwd` lib_LTLIBRARIES = libgmodule-1.3.la libgplugin_a.la libgplugin_b.la +if PLATFORM_WIN32 +no_undefined = -no-undefined +endif +if OS_WIN32 +export_symbols = -export-symbols gmodule.def +endif + libgmodule_1_3_la_SOURCES = gmodule.c libgmodule_1_3_la_LDFLAGS = \ @G_MODULE_LDFLAGS@ \ -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \ - -export-dynamic + -export-dynamic $(no_undefined) $(export_symbols) -libgmodule_1_3_la_LIBADD = @G_MODULE_LIBS_EXTRA@ @G_MODULE_LIBS@ # $(libglib) +libgmodule_1_3_la_LIBADD = @G_MODULE_LIBS_EXTRA@ @G_MODULE_LIBS@ $(libglib) # we should really depend on $(libglib) for libgmodule.la, but libtool has a -# problem with this ;( +# problem with this ;( Ummm? Does it? libgplugin_a_la_SOURCES = libgplugin_a.c -libgplugin_a_la_LDFLAGS = @G_MODULE_LDFLAGS@ -avoid-version -module -libgplugin_a_la_LIBADD = @G_MODULE_LIBS@ @G_MODULE_LIBS_EXTRA@ @G_MODULE_PLUGIN_LIBS@ # $(libglib) +libgplugin_a_la_LDFLAGS = @G_MODULE_LDFLAGS@ -avoid-version -module $(no_undefined) +libgplugin_a_la_LIBADD = @G_MODULE_LIBS@ @G_MODULE_LIBS_EXTRA@ @G_MODULE_PLUGIN_LIBS@ libgmodule-1.3.la $(libglib) libgplugin_b_la_SOURCES = libgplugin_b.c -libgplugin_b_la_LDFLAGS = @G_MODULE_LDFLAGS@ -avoid-version -module -libgplugin_b_la_LIBADD = @G_MODULE_LIBS@ @G_MODULE_LIBS_EXTRA@ @G_MODULE_PLUGIN_LIBS@ # $(libglib) +libgplugin_b_la_LDFLAGS = @G_MODULE_LDFLAGS@ -avoid-version -module $(no_undefined) +libgplugin_b_la_LIBADD = @G_MODULE_LIBS@ @G_MODULE_LIBS_EXTRA@ @G_MODULE_PLUGIN_LIBS@ libgmodule-1.3.la $(libglib) noinst_PROGRAMS = testgmodule testgmodule_LDFLAGS += @G_MODULE_LDFLAGS@ diff --git a/gmodule/gmodule-win32.c b/gmodule/gmodule-win32.c index 867b603d6..0f5aca719 100644 --- a/gmodule/gmodule-win32.c +++ b/gmodule/gmodule-win32.c @@ -38,6 +38,10 @@ #include #else +#ifdef G_WITH_CYGWIN +#include +#endif + /* The w32api headers supplied with the mingw gcc don't have * tlhelp32.h. We really only need the MODULEENTRY32 struct and the * TH32CS_SNAPMODULE value, so provide them here. @@ -77,6 +81,12 @@ _g_module_open (const gchar *file_name, gboolean bind_lazy) { HINSTANCE handle; +#ifdef G_WITH_CYGWIN + gchar tmp[MAX_PATH]; + + cygwin_conv_to_win32_path(file_name, tmp); + file_name = tmp; +#endif handle = LoadLibrary (file_name); if (!handle) diff --git a/gmodule/gmodule.h b/gmodule/gmodule.h index 39d00d71b..2c335aba3 100644 --- a/gmodule/gmodule.h +++ b/gmodule/gmodule.h @@ -29,19 +29,17 @@ #include -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ +G_BEGIN_DECLS /* exporting and importing functions, this is special cased * to feature Windows dll stubs. */ #define G_MODULE_IMPORT extern -#if defined (G_OS_WIN32) +#ifdef G_PLATFORM_WIN32 # define G_MODULE_EXPORT __declspec(dllexport) -#else /* !G_OS_WIN32 */ +#else /* !G_PLATFORM_WIN32 */ # define G_MODULE_EXPORT -#endif /* !G_OS_WIN32 */ +#endif /* !G_PLATFORM_WIN32 */ typedef enum { @@ -92,9 +90,6 @@ gchar* g_module_build_path (const gchar *directory, const gchar *module_name); -#ifdef __cplusplus -} -#endif /* __cplusplus */ - +G_END_DECLS #endif /* __GMODULE_H__ */