Use 'dumb quotes' rather than `really dumb quotes'
[platform/upstream/glib.git] / gmodule / gmodule.h
1 /* GMODULE - GLIB wrapper code for dynamic module loading
2  * Copyright (C) 1998 Tim Janik
3  *
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.
8  *
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.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 /*
21  * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
22  * file for a list of people on the GLib Team.  See the ChangeLog
23  * files for a list of changes.  These files are distributed with
24  * GLib at ftp://ftp.gtk.org/pub/gtk/. 
25  */
26
27 #ifndef __GMODULE_H__
28 #define __GMODULE_H__
29
30 #include <glib.h>
31
32 G_BEGIN_DECLS
33
34 /* exporting and importing functions, this is special cased
35  * to feature Windows dll stubs.
36  */
37 #define G_MODULE_IMPORT         extern
38 #ifdef G_PLATFORM_WIN32
39 #  define       G_MODULE_EXPORT         __declspec(dllexport)
40 #else /* !G_PLATFORM_WIN32 */
41 #  define       G_MODULE_EXPORT
42 #endif /* !G_PLATFORM_WIN32 */
43
44 typedef enum
45 {
46   G_MODULE_BIND_LAZY    = 1 << 0,
47   G_MODULE_BIND_LOCAL   = 1 << 1,
48   G_MODULE_BIND_MASK    = 0x03
49 } GModuleFlags;
50
51 typedef struct _GModule                  GModule;
52 typedef const gchar* (*GModuleCheckInit) (GModule       *module);
53 typedef void         (*GModuleUnload)    (GModule       *module);
54
55 /* return TRUE if dynamic module loading is supported */
56 GLIB_AVAILABLE_IN_ALL
57 gboolean        g_module_supported         (void) G_GNUC_CONST;
58
59 /* open a module 'file_name' and return handle, which is NULL on error */
60 GLIB_AVAILABLE_IN_ALL
61 GModule*              g_module_open          (const gchar  *file_name,
62                                               GModuleFlags  flags);
63
64 /* close a previously opened module, returns TRUE on success */
65 GLIB_AVAILABLE_IN_ALL
66 gboolean              g_module_close         (GModule      *module);
67
68 /* make a module resident so g_module_close on it will be ignored */
69 GLIB_AVAILABLE_IN_ALL
70 void                  g_module_make_resident (GModule      *module);
71
72 /* query the last module error as a string */
73 GLIB_AVAILABLE_IN_ALL
74 const gchar *         g_module_error         (void);
75
76 /* retrieve a symbol pointer from 'module', returns TRUE on success */
77 GLIB_AVAILABLE_IN_ALL
78 gboolean              g_module_symbol        (GModule      *module,
79                                               const gchar  *symbol_name,
80                                               gpointer     *symbol);
81
82 /* retrieve the file name from an existing module */
83 GLIB_AVAILABLE_IN_ALL
84 const gchar *         g_module_name          (GModule      *module);
85
86 /* Build the actual file name containing a module. 'directory' is the
87  * directory where the module file is supposed to be, or NULL or empty
88  * in which case it should either be in the current directory or, on
89  * some operating systems, in some standard place, for instance on the
90  * PATH. Hence, to be absoultely sure to get the correct module,
91  * always pass in a directory. The file name consists of the directory,
92  * if supplied, and 'module_name' suitably decorated according to
93  * the operating system's conventions (for instance lib*.so or *.dll).
94  *
95  * No checks are made that the file exists, or is of correct type.
96  */
97 GLIB_AVAILABLE_IN_ALL
98 gchar*                g_module_build_path    (const gchar  *directory,
99                                               const gchar  *module_name);
100
101
102 #ifndef __GTK_DOC_IGNORE__
103 #ifdef G_OS_WIN32
104 #define g_module_open g_module_open_utf8
105 #define g_module_name g_module_name_utf8
106
107 GLIB_AVAILABLE_IN_ALL
108 GModule *    g_module_open_utf8 (const gchar  *file_name,
109                                  GModuleFlags  flags);
110 GLIB_AVAILABLE_IN_ALL
111 const gchar *g_module_name_utf8 (GModule      *module);
112 #endif
113 #endif
114
115 G_END_DECLS
116
117 #endif /* __GMODULE_H__ */