/* GMODULE - GLIB wrapper code for dynamic module loading
* Copyright (C) 1998, 2000 Tim Janik
*
- * WIN32 GMODULE implementation
+ * Win32 GMODULE implementation
* Copyright (C) 1998 Tor Lillqvist
*
* This library is free software; you can redistribute it and/or
#include <stdio.h>
#include <windows.h>
+static void
+set_error (void)
+{
+ gchar *error = g_win32_error_message (GetLastError ());
+
+ g_module_set_error (error);
+ g_free (error);
+}
+
/* --- functions --- */
static gpointer
_g_module_open (const gchar *file_name,
handle = LoadLibrary (file_name);
if (!handle)
- {
- gchar error[100];
+ set_error ();
- sprintf (error, "Error code %d", GetLastError ());
- g_module_set_error (error);
- }
-
return handle;
}
handle = GetModuleHandle (NULL);
if (!handle)
- {
- gchar error[100];
-
- sprintf (error, "Error code %d", GetLastError ());
- g_module_set_error (error);
- }
+ set_error ();
return handle;
}
gboolean is_unref)
{
if (!FreeLibrary (handle))
- {
- gchar error[100];
-
- sprintf (error, "Error code %d", GetLastError ());
- g_module_set_error (error);
- }
+ set_error ();
}
static gpointer
p = GetProcAddress (handle, symbol_name);
if (!p)
- {
- gchar error[100];
+ set_error ();
- sprintf (error, "Error code %d", GetLastError ());
- g_module_set_error (error);
- }
-
return p;
}
}
#endif /* no implementation */
-#if defined (NATIVE_WIN32) && defined (__LCC__)
-int __stdcall
-LibMain (void *hinstDll,
- unsigned long dwReason,
- void *reserved)
-{
- return 1;
-}
-#endif /* NATIVE_WIN32 && __LCC__ */
-
-
/* --- functions --- */
gboolean
g_module_supported (void)
#include <gmodule.h>
-#if defined (NATIVE_WIN32) && defined (__LCC__)
-int __stdcall
-LibMain(void *hinstDll,
- unsigned long dwReason,
- void *reserved)
-{
- return 1;
-}
-#endif /* NATIVE_WIN32 && __LCC__ */
-
G_MODULE_EXPORT const gchar*
g_module_check_init (GModule *module)
{