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