williamr@2
|
1 |
/* GMODULE - GLIB wrapper code for dynamic module loading
|
williamr@2
|
2 |
* Copyright (C) 1998 Tim Janik
|
williamr@2
|
3 |
* Portions copyright (c) 2006 Nokia Corporation. All rights reserved.
|
williamr@2
|
4 |
*
|
williamr@2
|
5 |
* This library is free software; you can redistribute it and/or
|
williamr@2
|
6 |
* modify it under the terms of the GNU Lesser General Public
|
williamr@2
|
7 |
* License as published by the Free Software Foundation; either
|
williamr@2
|
8 |
* version 2 of the License, or (at your option) any later version.
|
williamr@2
|
9 |
*
|
williamr@2
|
10 |
* This library is distributed in the hope that it will be useful,
|
williamr@2
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
williamr@2
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
williamr@2
|
13 |
* Lesser General Public License for more details.
|
williamr@2
|
14 |
*
|
williamr@2
|
15 |
* You should have received a copy of the GNU Lesser General Public
|
williamr@2
|
16 |
* License along with this library; if not, write to the
|
williamr@2
|
17 |
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
williamr@2
|
18 |
* Boston, MA 02111-1307, USA.
|
williamr@2
|
19 |
*/
|
williamr@2
|
20 |
|
williamr@2
|
21 |
/*
|
williamr@2
|
22 |
* Modified by the GLib Team and others 1997-2000. See the AUTHORS
|
williamr@2
|
23 |
* file for a list of people on the GLib Team. See the ChangeLog
|
williamr@2
|
24 |
* files for a list of changes. These files are distributed with
|
williamr@2
|
25 |
* GLib at ftp://ftp.gtk.org/pub/gtk/.
|
williamr@2
|
26 |
*/
|
williamr@2
|
27 |
|
williamr@2
|
28 |
#ifndef __GMODULE_H__
|
williamr@2
|
29 |
#define __GMODULE_H__
|
williamr@2
|
30 |
|
williamr@2
|
31 |
#include <_ansi.h>
|
williamr@2
|
32 |
#include <glib.h>
|
williamr@2
|
33 |
|
williamr@2
|
34 |
G_BEGIN_DECLS
|
williamr@2
|
35 |
|
williamr@2
|
36 |
/* exporting and importing functions, this is special cased
|
williamr@2
|
37 |
* to feature Windows dll stubs.
|
williamr@2
|
38 |
*/
|
williamr@2
|
39 |
#define G_MODULE_IMPORT extern
|
williamr@2
|
40 |
#ifdef G_PLATFORM_WIN32
|
williamr@2
|
41 |
# define G_MODULE_EXPORT __declspec(dllexport)
|
williamr@2
|
42 |
#else /* !G_PLATFORM_WIN32 */
|
williamr@2
|
43 |
# define G_MODULE_EXPORT
|
williamr@2
|
44 |
#endif /* !G_PLATFORM_WIN32 */
|
williamr@2
|
45 |
|
williamr@2
|
46 |
typedef enum
|
williamr@2
|
47 |
{
|
williamr@2
|
48 |
G_MODULE_BIND_LAZY = 1 << 0,
|
williamr@2
|
49 |
G_MODULE_BIND_LOCAL = 1 << 1,
|
williamr@2
|
50 |
G_MODULE_BIND_MASK = 0x03
|
williamr@2
|
51 |
} GModuleFlags;
|
williamr@2
|
52 |
|
williamr@2
|
53 |
typedef struct _GModule GModule;
|
williamr@2
|
54 |
typedef const gchar* (*GModuleCheckInit) (GModule *module);
|
williamr@2
|
55 |
typedef void (*GModuleUnload) (GModule *module);
|
williamr@2
|
56 |
|
williamr@2
|
57 |
#ifdef G_OS_WIN32
|
williamr@2
|
58 |
#define g_module_open g_module_open_utf8
|
williamr@2
|
59 |
#define g_module_name g_module_name_utf8
|
williamr@2
|
60 |
#endif
|
williamr@2
|
61 |
|
williamr@2
|
62 |
/* return TRUE if dynamic module loading is supported */
|
williamr@2
|
63 |
IMPORT_C gboolean g_module_supported (void) G_GNUC_CONST;
|
williamr@2
|
64 |
|
williamr@2
|
65 |
/* open a module `file_name' and return handle, which is NULL on error */
|
williamr@2
|
66 |
IMPORT_C GModule* g_module_open (const gchar *file_name,
|
williamr@2
|
67 |
GModuleFlags flags);
|
williamr@2
|
68 |
|
williamr@2
|
69 |
/* close a previously opened module, returns TRUE on success */
|
williamr@2
|
70 |
IMPORT_C gboolean g_module_close (GModule *module);
|
williamr@2
|
71 |
|
williamr@2
|
72 |
/* make a module resident so g_module_close on it will be ignored */
|
williamr@2
|
73 |
IMPORT_C void g_module_make_resident (GModule *module);
|
williamr@2
|
74 |
|
williamr@2
|
75 |
/* query the last module error as a string */
|
williamr@2
|
76 |
IMPORT_C G_CONST_RETURN gchar* g_module_error (void);
|
williamr@2
|
77 |
|
williamr@2
|
78 |
/* retrieve a symbol pointer from `module', returns TRUE on success */
|
williamr@2
|
79 |
IMPORT_C gboolean g_module_symbol (GModule *module,
|
williamr@2
|
80 |
const gchar *symbol_name,
|
williamr@2
|
81 |
gpointer *symbol);
|
williamr@2
|
82 |
|
williamr@2
|
83 |
/* retrieve the file name from an existing module */
|
williamr@2
|
84 |
IMPORT_C G_CONST_RETURN gchar* g_module_name (GModule *module);
|
williamr@2
|
85 |
|
williamr@2
|
86 |
/* Build the actual file name containing a module. `directory' is the
|
williamr@2
|
87 |
* directory where the module file is supposed to be, or NULL or empty
|
williamr@2
|
88 |
* in which case it should either be in the current directory or, on
|
williamr@2
|
89 |
* some operating systems, in some standard place, for instance on the
|
williamr@2
|
90 |
* PATH. Hence, to be absoultely sure to get the correct module,
|
williamr@2
|
91 |
* always pass in a directory. The file name consists of the directory,
|
williamr@2
|
92 |
* if supplied, and `module_name' suitably decorated accoring to
|
williamr@2
|
93 |
* the operating system's conventions (for instance lib*.so or *.dll).
|
williamr@2
|
94 |
*
|
williamr@2
|
95 |
* No checks are made that the file exists, or is of correct type.
|
williamr@2
|
96 |
*/
|
williamr@2
|
97 |
IMPORT_C gchar* g_module_build_path (const gchar *directory,
|
williamr@2
|
98 |
const gchar *module_name);
|
williamr@2
|
99 |
|
williamr@2
|
100 |
|
williamr@2
|
101 |
G_END_DECLS
|
williamr@2
|
102 |
|
williamr@2
|
103 |
#endif /* __GMODULE_H__ */
|