00001 /* GMODULE - GLIB wrapper code for dynamic module loading 00002 * Copyright (C) 1998 Tim Janik 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Lesser General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2 of the License, or (at your option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Lesser General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public 00015 * License along with this library; if not, write to the 00016 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00017 * Boston, MA 02111-1307, USA. 00018 */ 00019 00020 /* 00021 * Modified by the GLib Team and others 1997-2000. See the AUTHORS 00022 * file for a list of people on the GLib Team. See the ChangeLog 00023 * files for a list of changes. These files are distributed with 00024 * GLib at ftp://ftp.gtk.org/pub/gtk/. 00025 */ 00026 00027 #ifndef __GMODULE_H__ 00028 #define __GMODULE_H__ 00029 00030 #include <glib.h> 00031 00032 G_BEGIN_DECLS 00033 00034 /* exporting and importing functions, this is special cased 00035 * to feature Windows dll stubs. 00036 */ 00037 #define G_MODULE_IMPORT extern 00038 #ifdef G_PLATFORM_WIN32 00039 # define G_MODULE_EXPORT __declspec(dllexport) 00040 #else /* !G_PLATFORM_WIN32 */ 00041 # define G_MODULE_EXPORT 00042 #endif /* !G_PLATFORM_WIN32 */ 00043 00044 typedef enum 00045 { 00046 G_MODULE_BIND_LAZY = 1 << 0, 00047 G_MODULE_BIND_LOCAL = 1 << 1, 00048 G_MODULE_BIND_MASK = 0x03 00049 } GModuleFlags; 00050 00051 typedef struct _GModule GModule; 00052 typedef const gchar* (*GModuleCheckInit) (GModule *module); 00053 typedef void (*GModuleUnload) (GModule *module); 00054 00055 #ifdef G_OS_WIN32 00056 #define g_module_open g_module_open_utf8 00057 #define g_module_name g_module_name_utf8 00058 #endif 00059 00060 /* return TRUE if dynamic module loading is supported */ 00061 gboolean g_module_supported (void) G_GNUC_CONST; 00062 00063 /* open a module `file_name' and return handle, which is NULL on error */ 00064 GModule* g_module_open (const gchar *file_name, 00065 GModuleFlags flags); 00066 00067 /* close a previously opened module, returns TRUE on success */ 00068 gboolean g_module_close (GModule *module); 00069 00070 /* make a module resident so g_module_close on it will be ignored */ 00071 void g_module_make_resident (GModule *module); 00072 00073 /* query the last module error as a string */ 00074 G_CONST_RETURN gchar* g_module_error (void); 00075 00076 /* retrieve a symbol pointer from `module', returns TRUE on success */ 00077 gboolean g_module_symbol (GModule *module, 00078 const gchar *symbol_name, 00079 gpointer *symbol); 00080 00081 /* retrieve the file name from an existing module */ 00082 G_CONST_RETURN gchar* g_module_name (GModule *module); 00083 00084 /* Build the actual file name containing a module. `directory' is the 00085 * directory where the module file is supposed to be, or NULL or empty 00086 * in which case it should either be in the current directory or, on 00087 * some operating systems, in some standard place, for instance on the 00088 * PATH. Hence, to be absoultely sure to get the correct module, 00089 * always pass in a directory. The file name consists of the directory, 00090 * if supplied, and `module_name' suitably decorated accoring to 00091 * the operating system's conventions (for instance lib*.so or *.dll). 00092 * 00093 * No checks are made that the file exists, or is of correct type. 00094 */ 00095 gchar* g_module_build_path (const gchar *directory, 00096 const gchar *module_name); 00097 00098 00099 G_END_DECLS 00100 00101 #endif /* __GMODULE_H__ */
1.5.9