removed dummy structure definitions for struct _GCache, _GTree, _GTimer,
[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 Library 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  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library 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 #ifndef __GMODULE_H__
20 #define __GMODULE_H__
21
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif /* __cplusplus */
26
27 extern const char      *g_log_domain_gmodule;
28 #include <glib.h>
29
30
31 /* exporting and importing functions, this is special cased
32  * to feature Windows dll stubs.
33  */
34 #define G_MODULE_IMPORT         extern
35 #ifdef NATIVE_WIN32
36 #  define       G_MODULE_EXPORT         __declspec(dllexport)
37 #else /* !NATIVE_WIN32 */
38 #  define       G_MODULE_EXPORT
39 #endif /* !NATIVE_WIN32 */
40
41 typedef enum
42 {
43   G_MODULE_BIND_LAZY    = 1 << 0,
44   G_MODULE_BIND_MASK    = 0x01
45 } GModuleFlags;
46
47 typedef struct _GModule                  GModule;
48 typedef const gchar* (*GModuleCheckInit) (GModule       *module);
49 typedef void         (*GModuleUnload)    (GModule       *module);
50
51 /* return TRUE if dynamic module loading is supported */
52 gboolean        g_module_supported         (void);
53
54 /* open a module `file_name' and return handle, which is NULL on error */
55 GModule*        g_module_open              (const gchar         *file_name,
56                                             GModuleFlags         flags);
57
58 /* close a previously opened module, returns TRUE on success */
59 gboolean        g_module_close             (GModule             *module);
60
61 /* make a module resident so g_module_close on it will be ignored */
62 void            g_module_make_resident     (GModule             *module);
63
64 /* query the last module error as a string */
65 gchar*          g_module_error             (void);
66
67 /* retrive a symbol pointer from `module', returns TRUE on success */
68 gboolean        g_module_symbol            (GModule             *module,
69                                             const gchar         *symbol_name,
70                                             gpointer            *symbol);
71
72 /* retrive the file name from an existing module */
73 gchar*          g_module_name              (GModule             *module);
74
75
76 /* Build the actual file name containing a module. `directory' is the
77  * directory where the module file is supposed to be, or NULL or empty
78  * in which case it should either be in the current directory or, on
79  * some operating systems, in some standard place, for instance on the
80  * PATH. Hence, to be absoultely sure to get the correct module,
81  * always pass in a directory. The file name consists of the directory,
82  * if supplied, and `module_name' suitably decorated accoring to
83  * the operating system's conventions (for instance lib*.so or *.dll).
84  *
85  * No checks are made that the file exists, or is of correct type.
86  */
87 gchar*          g_module_build_path       (const gchar          *directory,
88                                            const gchar          *module_name);
89
90 #ifdef __cplusplus
91 }
92 #endif /* __cplusplus */
93
94
95 #endif /* __GMODULE_H__ */