Do not attempt to autolaunch a session dbus-daemon with no DISPLAY
[glib.git] / gmodule / gmodule.h
blob194fa6e69d25090d22641ffc301b23912c25d5cf
1 /* GMODULE - GLIB wrapper code for dynamic module loading
2 * Copyright (C) 1998 Tim Janik
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
19 * Modified by the GLib Team and others 1997-2000. See the AUTHORS
20 * file for a list of people on the GLib Team. See the ChangeLog
21 * files for a list of changes. These files are distributed with
22 * GLib at ftp://ftp.gtk.org/pub/gtk/.
25 #ifndef __GMODULE_H__
26 #define __GMODULE_H__
28 #include <glib.h>
30 G_BEGIN_DECLS
32 /* exporting and importing functions, this is special cased
33 * to feature Windows dll stubs.
35 #define G_MODULE_IMPORT extern
36 #ifdef G_PLATFORM_WIN32
37 # define G_MODULE_EXPORT __declspec(dllexport)
38 #else /* !G_PLATFORM_WIN32 */
39 # define G_MODULE_EXPORT
40 #endif /* !G_PLATFORM_WIN32 */
42 typedef enum
44 G_MODULE_BIND_LAZY = 1 << 0,
45 G_MODULE_BIND_LOCAL = 1 << 1,
46 G_MODULE_BIND_MASK = 0x03
47 } GModuleFlags;
49 typedef struct _GModule GModule;
50 typedef const gchar* (*GModuleCheckInit) (GModule *module);
51 typedef void (*GModuleUnload) (GModule *module);
53 /* return TRUE if dynamic module loading is supported */
54 GLIB_AVAILABLE_IN_ALL
55 gboolean g_module_supported (void) G_GNUC_CONST;
57 /* open a module 'file_name' and return handle, which is NULL on error */
58 GLIB_AVAILABLE_IN_ALL
59 GModule* g_module_open (const gchar *file_name,
60 GModuleFlags flags);
62 /* close a previously opened module, returns TRUE on success */
63 GLIB_AVAILABLE_IN_ALL
64 gboolean g_module_close (GModule *module);
66 /* make a module resident so g_module_close on it will be ignored */
67 GLIB_AVAILABLE_IN_ALL
68 void g_module_make_resident (GModule *module);
70 /* query the last module error as a string */
71 GLIB_AVAILABLE_IN_ALL
72 const gchar * g_module_error (void);
74 /* retrieve a symbol pointer from 'module', returns TRUE on success */
75 GLIB_AVAILABLE_IN_ALL
76 gboolean g_module_symbol (GModule *module,
77 const gchar *symbol_name,
78 gpointer *symbol);
80 /* retrieve the file name from an existing module */
81 GLIB_AVAILABLE_IN_ALL
82 const gchar * g_module_name (GModule *module);
84 /* Build the actual file name containing a module. 'directory' is the
85 * directory where the module file is supposed to be, or NULL or empty
86 * in which case it should either be in the current directory or, on
87 * some operating systems, in some standard place, for instance on the
88 * PATH. Hence, to be absoultely sure to get the correct module,
89 * always pass in a directory. The file name consists of the directory,
90 * if supplied, and 'module_name' suitably decorated according to
91 * the operating system's conventions (for instance lib*.so or *.dll).
93 * No checks are made that the file exists, or is of correct type.
95 GLIB_AVAILABLE_IN_ALL
96 gchar* g_module_build_path (const gchar *directory,
97 const gchar *module_name);
100 #ifndef __GTK_DOC_IGNORE__
101 #ifdef G_OS_WIN32
102 #define g_module_open g_module_open_utf8
103 #define g_module_name g_module_name_utf8
105 GLIB_AVAILABLE_IN_ALL
106 GModule * g_module_open_utf8 (const gchar *file_name,
107 GModuleFlags flags);
108 GLIB_AVAILABLE_IN_ALL
109 const gchar *g_module_name_utf8 (GModule *module);
110 #endif
111 #endif
113 G_END_DECLS
115 #endif /* __GMODULE_H__ */