diff -ur glib-2.0.6.orig/gmodule/gmodule-win32.c glib-2.0.6/gmodule/gmodule-win32.c
--- glib-2.0.6.orig/gmodule/gmodule-win32.c	2001-11-25 03:53:02.000000000 +0900
+++ glib-2.0.6/gmodule/gmodule-win32.c	2002-09-10 00:57:04.000000000 +0900
@@ -36,17 +36,38 @@
 
 #include <tlhelp32.h>
 
-#ifdef G_WITH_CYGWIN
-#include <sys/cygwin.h>
-#endif
+#ifdef __CYGWIN__
+#include <dlfcn.h>
+
+static gchar*
+fetch_dlerror (gboolean replace_null)
+{
+  gchar *msg = dlerror ();
+
+  /* make sure we always return an error message != NULL, if
+   * expected to do so. */
+
+  if (!msg && replace_null)
+    return "unknown dl-error";
+
+  return msg;
+}
+
+#endif /* __CYGWIN__ */
 
 static void
 set_error (void)
 {
+#ifndef __CYGWIN__
   gchar *error = g_win32_error_message (GetLastError ());
+#else
+  gchar *error = fetch_dlerror (TRUE);
+#endif
 
   g_module_set_error (error);
+#ifndef __CYGWIN__
   g_free (error);
+#endif
 }
 
 /* --- functions --- */
@@ -54,15 +75,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;
+#ifndef __CYGWIN__
+  HINSTANCE handle = LoadLibrary (file_name);
+#else
+  gpointer handle = dlopen (file_name, RTLD_GLOBAL | (bind_lazy ? RTLD_LAZY : RTLD_NOW));
 #endif
-  
-  handle = LoadLibrary (file_name);
+
   if (!handle)
     set_error ();
 
@@ -83,7 +101,11 @@
 		 gboolean is_unref)
 {
   if (handle != null_module_handle)
+#ifndef _CYGWIN__
     if (!FreeLibrary (handle))
+#else
+    if (dlclose (handle) != 0)
+#endif
       set_error ();
 }
 
@@ -210,7 +232,11 @@
 	p = find_in_any_module (symbol_name);
     }
   else
+#ifndef __CYGWIN__
     p = GetProcAddress (handle, symbol_name);
+#else
+    p = dlsym (handle, symbol_name);
+#endif
 
   if (!p)
     set_error ();
@@ -218,6 +244,10 @@
   return p;
 }
 
+/* 
+ * cygwin may have either lib or cyg as prefix for dll name
+ * where we are forced to guess, we use cyg
+ */
 static gchar*
 _g_module_build_path (const gchar *directory,
 		      const gchar *module_name)
@@ -229,14 +259,32 @@
   if (directory && *directory)
     if (k > 4 && g_strcasecmp (module_name + k - 4, ".dll") == 0)
       return g_strconcat (directory, G_DIR_SEPARATOR_S, module_name, NULL);
+#ifndef __CYGWIN__
     else if (strncmp (module_name, "lib", 3) == 0)
+#else
+    else if (strncmp (module_name, "lib", 3) == 0 ||
+             strncmp (module_name, "cyg", 3) == 0)
+#endif
       return g_strconcat (directory, G_DIR_SEPARATOR_S, module_name, ".dll", NULL);
     else
+#ifndef __CYGWIN__
       return g_strconcat (directory, G_DIR_SEPARATOR_S, "lib", module_name, ".dll", NULL);
+#else
+      return g_strconcat (directory, G_DIR_SEPARATOR_S, "cyg", module_name, ".dll", NULL);
+#endif
   else if (k > 4 && g_strcasecmp (module_name + k - 4, ".dll") == 0)
     return g_strdup (module_name);
+#ifndef __CYGWIN__
   else if (strncmp (module_name, "lib", 3) == 0)
+#else
+  else if (strncmp (module_name, "lib", 3) == 0 ||
+           strncmp (module_name, "cyg", 3) == 0)
+#endif
     return g_strconcat (module_name, ".dll", NULL);
   else
+#ifndef __CYGWIN__
     return g_strconcat ("lib", module_name, ".dll", NULL);
+#else
+    return g_strconcat ("cyg", module_name, ".dll", NULL);
+#endif
 }
