Main Page | Class List | Directories | File List | Class Members | File Members

gmodule-win32.c File Reference

#include <stdio.h>
#include <windows.h>

Go to the source code of this file.

Functions

static gpointer _g_module_open (const gchar *file_name, gboolean bind_lazy)
static gpointer _g_module_self (void)
static void _g_module_close (gpointer handle, gboolean is_unref)
static gpointer _g_module_symbol (gpointer handle, const gchar *symbol_name)
static gchar_g_module_build_path (const gchar *directory, const gchar *module_name)


Function Documentation

static gchar* _g_module_build_path const gchar directory,
const gchar module_name
[static]
 

Definition at line 105 of file gmodule-win32.c.

References g_strcasecmp(), g_strconcat(), g_strdup(), and NULL.

00107 {
00108   gint k;
00109   
00110   k = strlen (module_name);
00111   if (directory && *directory)
00112     if (k > 4 && g_strcasecmp (module_name + k - 4, ".dll") == 0)
00113       return g_strconcat (directory, "\\", module_name, NULL);
00114     else
00115       return g_strconcat (directory, "\\", module_name, ".dll", NULL);
00116   else if (k > 4 && g_strcasecmp (module_name + k - 4, ".dll") == 0)
00117     return g_strdup (module_name);
00118   else
00119     return g_strconcat (module_name, ".dll", NULL);
00120 }

static void _g_module_close gpointer  handle,
gboolean  is_unref
[static]
 

Definition at line 74 of file gmodule-win32.c.

References g_module_set_error().

00076 {
00077   if (!FreeLibrary (handle))
00078     {
00079       gchar error[100];
00080 
00081       sprintf (error, "Error code %d", GetLastError ());
00082       g_module_set_error (error);
00083     }
00084 }

static gpointer _g_module_open const gchar file_name,
gboolean  bind_lazy
[static]
 

Definition at line 39 of file gmodule-win32.c.

References g_module_set_error().

00041 {
00042   HINSTANCE handle;
00043   
00044   handle = LoadLibrary (file_name);
00045   if (!handle)
00046     {
00047       gchar error[100];
00048 
00049       sprintf (error, "Error code %d", GetLastError ());
00050       g_module_set_error (error);
00051     }
00052   
00053   return handle;
00054 }

static gpointer _g_module_self void   )  [static]
 

Definition at line 57 of file gmodule-win32.c.

References g_module_set_error(), and NULL.

00058 {
00059   HMODULE handle;
00060   
00061   handle = GetModuleHandle (NULL);
00062   if (!handle)
00063     {
00064       gchar error[100];
00065 
00066       sprintf (error, "Error code %d", GetLastError ());
00067       g_module_set_error (error);
00068     }
00069   
00070   return handle;
00071 }

static gpointer _g_module_symbol gpointer  handle,
const gchar symbol_name
[static]
 

Definition at line 87 of file gmodule-win32.c.

References g_module_set_error().

00089 {
00090   gpointer p;
00091   
00092   p = GetProcAddress (handle, symbol_name);
00093   if (!p)
00094     {
00095       gchar error[100];
00096 
00097       sprintf (error, "Error code %d", GetLastError ());
00098       g_module_set_error (error);
00099     }
00100   
00101   return p;
00102 }


© sourcejam.com 2005-2008