williamr@2: /* GMODULE - GLIB wrapper code for dynamic module loading williamr@2: * Copyright (C) 1998 Tim Janik williamr@2: * Portions copyright (c) 2006 Nokia Corporation. All rights reserved. williamr@2: * williamr@2: * This library is free software; you can redistribute it and/or williamr@2: * modify it under the terms of the GNU Lesser General Public williamr@2: * License as published by the Free Software Foundation; either williamr@2: * version 2 of the License, or (at your option) any later version. williamr@2: * williamr@2: * This library is distributed in the hope that it will be useful, williamr@2: * but WITHOUT ANY WARRANTY; without even the implied warranty of williamr@2: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU williamr@2: * Lesser General Public License for more details. williamr@2: * williamr@2: * You should have received a copy of the GNU Lesser General Public williamr@2: * License along with this library; if not, write to the williamr@2: * Free Software Foundation, Inc., 59 Temple Place - Suite 330, williamr@2: * Boston, MA 02111-1307, USA. williamr@2: */ williamr@2: williamr@2: /* williamr@2: * Modified by the GLib Team and others 1997-2000. See the AUTHORS williamr@2: * file for a list of people on the GLib Team. See the ChangeLog williamr@2: * files for a list of changes. These files are distributed with williamr@2: * GLib at ftp://ftp.gtk.org/pub/gtk/. williamr@2: */ williamr@2: williamr@2: #ifndef __GMODULE_H__ williamr@2: #define __GMODULE_H__ williamr@2: williamr@2: #include <_ansi.h> williamr@2: #include williamr@2: williamr@2: G_BEGIN_DECLS williamr@2: williamr@2: /* exporting and importing functions, this is special cased williamr@2: * to feature Windows dll stubs. williamr@2: */ williamr@2: #define G_MODULE_IMPORT extern williamr@2: #ifdef G_PLATFORM_WIN32 williamr@2: # define G_MODULE_EXPORT __declspec(dllexport) williamr@2: #else /* !G_PLATFORM_WIN32 */ williamr@2: # define G_MODULE_EXPORT williamr@2: #endif /* !G_PLATFORM_WIN32 */ williamr@2: williamr@2: typedef enum williamr@2: { williamr@2: G_MODULE_BIND_LAZY = 1 << 0, williamr@2: G_MODULE_BIND_LOCAL = 1 << 1, williamr@2: G_MODULE_BIND_MASK = 0x03 williamr@2: } GModuleFlags; williamr@2: williamr@2: typedef struct _GModule GModule; williamr@2: typedef const gchar* (*GModuleCheckInit) (GModule *module); williamr@2: typedef void (*GModuleUnload) (GModule *module); williamr@2: williamr@2: #ifdef G_OS_WIN32 williamr@2: #define g_module_open g_module_open_utf8 williamr@2: #define g_module_name g_module_name_utf8 williamr@2: #endif williamr@2: williamr@2: /* return TRUE if dynamic module loading is supported */ williamr@2: IMPORT_C gboolean g_module_supported (void) G_GNUC_CONST; williamr@2: williamr@2: /* open a module `file_name' and return handle, which is NULL on error */ williamr@2: IMPORT_C GModule* g_module_open (const gchar *file_name, williamr@2: GModuleFlags flags); williamr@2: williamr@2: /* close a previously opened module, returns TRUE on success */ williamr@2: IMPORT_C gboolean g_module_close (GModule *module); williamr@2: williamr@2: /* make a module resident so g_module_close on it will be ignored */ williamr@2: IMPORT_C void g_module_make_resident (GModule *module); williamr@2: williamr@2: /* query the last module error as a string */ williamr@2: IMPORT_C G_CONST_RETURN gchar* g_module_error (void); williamr@2: williamr@2: /* retrieve a symbol pointer from `module', returns TRUE on success */ williamr@2: IMPORT_C gboolean g_module_symbol (GModule *module, williamr@2: const gchar *symbol_name, williamr@2: gpointer *symbol); williamr@2: williamr@2: /* retrieve the file name from an existing module */ williamr@2: IMPORT_C G_CONST_RETURN gchar* g_module_name (GModule *module); williamr@2: williamr@2: /* Build the actual file name containing a module. `directory' is the williamr@2: * directory where the module file is supposed to be, or NULL or empty williamr@2: * in which case it should either be in the current directory or, on williamr@2: * some operating systems, in some standard place, for instance on the williamr@2: * PATH. Hence, to be absoultely sure to get the correct module, williamr@2: * always pass in a directory. The file name consists of the directory, williamr@2: * if supplied, and `module_name' suitably decorated accoring to williamr@2: * the operating system's conventions (for instance lib*.so or *.dll). williamr@2: * williamr@2: * No checks are made that the file exists, or is of correct type. williamr@2: */ williamr@2: IMPORT_C gchar* g_module_build_path (const gchar *directory, williamr@2: const gchar *module_name); williamr@2: williamr@2: williamr@2: G_END_DECLS williamr@2: williamr@2: #endif /* __GMODULE_H__ */