Blame gmodule/gmodule.h

Packit ae235b
/* GMODULE - GLIB wrapper code for dynamic module loading
Packit ae235b
 * Copyright (C) 1998 Tim Janik
Packit ae235b
 *
Packit ae235b
 * This library is free software; you can redistribute it and/or
Packit ae235b
 * modify it under the terms of the GNU Lesser General Public
Packit ae235b
 * License as published by the Free Software Foundation; either
Packit ae235b
 * version 2.1 of the License, or (at your option) any later version.
Packit ae235b
 *
Packit ae235b
 * This library is distributed in the hope that it will be useful,
Packit ae235b
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit ae235b
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
Packit ae235b
 * Lesser General Public License for more details.
Packit ae235b
 *
Packit ae235b
 * You should have received a copy of the GNU Lesser General Public
Packit ae235b
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
Packit ae235b
 */
Packit ae235b
Packit ae235b
/*
Packit ae235b
 * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
Packit ae235b
 * file for a list of people on the GLib Team.  See the ChangeLog
Packit ae235b
 * files for a list of changes.  These files are distributed with
Packit ae235b
 * GLib at ftp://ftp.gtk.org/pub/gtk/. 
Packit ae235b
 */
Packit ae235b
Packit ae235b
#ifndef __GMODULE_H__
Packit ae235b
#define __GMODULE_H__
Packit ae235b
Packit ae235b
#include <glib.h>
Packit ae235b
Packit ae235b
G_BEGIN_DECLS
Packit ae235b
Packit ae235b
/* exporting and importing functions, this is special cased
Packit ae235b
 * to feature Windows dll stubs.
Packit ae235b
 */
Packit ae235b
#define	G_MODULE_IMPORT		extern
Packit ae235b
#ifdef G_PLATFORM_WIN32
Packit ae235b
#  define	G_MODULE_EXPORT		__declspec(dllexport)
Packit ae235b
#elif __GNUC__ >= 4
Packit ae235b
#  define	G_MODULE_EXPORT		__attribute__((visibility("default")))
Packit ae235b
#else /* !G_PLATFORM_WIN32 && __GNUC__ < 4 */
Packit ae235b
#  define	G_MODULE_EXPORT
Packit ae235b
#endif /* !G_PLATFORM_WIN32 */
Packit ae235b
Packit ae235b
/**
Packit ae235b
 * GModuleFlags:
Packit ae235b
 * @G_MODULE_BIND_LAZY: specifies that symbols are only resolved when
Packit ae235b
 *     needed. The default action is to bind all symbols when the module
Packit ae235b
 *     is loaded.
Packit ae235b
 * @G_MODULE_BIND_LOCAL: specifies that symbols in the module should
Packit ae235b
 *     not be added to the global name space. The default action on most
Packit ae235b
 *     platforms is to place symbols in the module in the global name space,
Packit ae235b
 *     which may cause conflicts with existing symbols.
Packit ae235b
 * @G_MODULE_BIND_MASK: mask for all flags.
Packit ae235b
 *
Packit ae235b
 * Flags passed to g_module_open().
Packit ae235b
 * Note that these flags are not supported on all platforms.
Packit ae235b
 */
Packit ae235b
typedef enum
Packit ae235b
{
Packit ae235b
  G_MODULE_BIND_LAZY	= 1 << 0,
Packit ae235b
  G_MODULE_BIND_LOCAL	= 1 << 1,
Packit ae235b
  G_MODULE_BIND_MASK	= 0x03
Packit ae235b
} GModuleFlags;
Packit ae235b
Packit ae235b
typedef	struct _GModule			 GModule;
Packit ae235b
typedef const gchar* (*GModuleCheckInit) (GModule	*module);
Packit ae235b
typedef void	     (*GModuleUnload)	 (GModule	*module);
Packit ae235b
Packit ae235b
/* return TRUE if dynamic module loading is supported */
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean	g_module_supported	   (void) G_GNUC_CONST;
Packit ae235b
Packit ae235b
/* open a module 'file_name' and return handle, which is NULL on error */
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GModule*              g_module_open          (const gchar  *file_name,
Packit ae235b
					      GModuleFlags  flags);
Packit ae235b
Packit ae235b
/* close a previously opened module, returns TRUE on success */
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean              g_module_close         (GModule      *module);
Packit ae235b
Packit ae235b
/* make a module resident so g_module_close on it will be ignored */
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void                  g_module_make_resident (GModule      *module);
Packit ae235b
Packit ae235b
/* query the last module error as a string */
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
const gchar *         g_module_error         (void);
Packit ae235b
Packit ae235b
/* retrieve a symbol pointer from 'module', returns TRUE on success */
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean              g_module_symbol        (GModule      *module,
Packit ae235b
					      const gchar  *symbol_name,
Packit ae235b
					      gpointer     *symbol);
Packit ae235b
Packit ae235b
/* retrieve the file name from an existing module */
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
const gchar *         g_module_name          (GModule      *module);
Packit ae235b
Packit ae235b
/* Build the actual file name containing a module. 'directory' is the
Packit ae235b
 * directory where the module file is supposed to be, or NULL or empty
Packit ae235b
 * in which case it should either be in the current directory or, on
Packit ae235b
 * some operating systems, in some standard place, for instance on the
Packit ae235b
 * PATH. Hence, to be absoultely sure to get the correct module,
Packit ae235b
 * always pass in a directory. The file name consists of the directory,
Packit ae235b
 * if supplied, and 'module_name' suitably decorated according to
Packit ae235b
 * the operating system's conventions (for instance lib*.so or *.dll).
Packit ae235b
 *
Packit ae235b
 * No checks are made that the file exists, or is of correct type.
Packit ae235b
 */
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gchar*                g_module_build_path    (const gchar  *directory,
Packit ae235b
					      const gchar  *module_name);
Packit ae235b
Packit ae235b
G_END_DECLS
Packit ae235b
Packit ae235b
#endif /* __GMODULE_H__ */