implemented g_datalist_* along the lines of g_dataset, but operates on an
[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 #pragma }
26 #endif /* __cplusplus */
27
28 extern const char      *g_log_domain_gmodule;
29 #include <glib.h>
30
31
32 /* exporting and importing functions,
33  * we need autoconf support here to feature Windows dll stubs.
34  */
35 #define G_MODULE_IMPORT         extern
36 #define G_MODULE_EXPORT
37
38
39 typedef enum
40 {
41   G_MODULE_BIND_LAZY    = 1 << 0,
42   G_MODULE_BIND_MASK    = 0x01
43 } GModuleFlags;
44
45 typedef struct _GModule                  GModule;
46 typedef const gchar* (*GModuleCheckInit) (GModule       *module);
47 typedef void         (*GModuleDeInit)    (GModule       *module);
48
49 /* return TRUE if dynamic module loading is supported */
50 gboolean        g_module_supported         (void);
51
52 /* open a module `file_name' and return handle, which is NULL on error */
53 GModule*        g_module_open              (const gchar         *file_name,
54                                             GModuleFlags         flags);
55
56 /* close a previously opened module, returns TRUE on success */
57 gboolean        g_module_close             (GModule             *module);
58
59 /* make a module resident so g_module_close on it will be ignored */
60 void            g_module_make_resident     (GModule             *module);
61
62 /* query the last module error as a string */
63 gchar*          g_module_error             (void);
64
65 /* retrive a symbol pointer from `module', returns TRUE on success */
66 gboolean        g_module_symbol            (GModule             *module,
67                                             const gchar         *symbol_name,
68                                             gpointer            *symbol);
69
70 /* retrive the file name from an existing module */
71 gchar*          g_module_name              (GModule             *module);
72
73
74 #ifdef __cplusplus
75 }
76 #endif /* __cplusplus */
77
78
79 #endif /* __GMODULE_H__ */