Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
gmodule.h
Go to the documentation of this file.
1/* GMODULE - GLIB wrapper code for dynamic module loading
2 * Copyright (C) 1998 Tim Janik
3 *
4 * SPDX-License-Identifier: LGPL-2.1-or-later
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
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>
32
34
35/* exporting and importing functions, this is special cased
36 * to feature Windows dll stubs.
37 */
38#if defined(_WIN32) || defined(__CYGWIN__)
39# define G_MODULE_EXPORT __declspec(dllexport)
40# define G_MODULE_IMPORT __declspec(dllimport) extern
41#elif __GNUC__ >= 4
42# define G_MODULE_EXPORT __attribute__((visibility("default")))
43# define G_MODULE_IMPORT extern
44#else /* !defined(_WIN32) && !defined(__CYGWIN__) && __GNUC__ < 4 */
45# define G_MODULE_EXPORT
46# define G_MODULE_IMPORT extern
47#endif
48
49/**
50 * GModuleFlags:
51 * @G_MODULE_BIND_LAZY: specifies that symbols are only resolved when
52 * needed. The default action is to bind all symbols when the module
53 * is loaded.
54 * @G_MODULE_BIND_LOCAL: specifies that symbols in the module should
55 * not be added to the global name space. The default action on most
56 * platforms is to place symbols in the module in the global name space,
57 * which may cause conflicts with existing symbols.
58 * @G_MODULE_BIND_MASK: mask for all flags.
59 *
60 * Flags passed to g_module_open().
61 * Note that these flags are not supported on all platforms.
62 */
63typedef enum
64{
69
70typedef struct _GModule GModule;
71typedef const gchar* (*GModuleCheckInit) (GModule *module);
72typedef void (*GModuleUnload) (GModule *module);
73
74#define G_MODULE_ERROR g_module_error_quark () GMODULE_AVAILABLE_MACRO_IN_2_70
77
78/**
79 * GModuleError:
80 * @G_MODULE_ERROR_FAILED: there was an error loading or opening a module file
81 * @G_MODULE_ERROR_CHECK_FAILED: a module returned an error from its `g_module_check_init()` function
82 *
83 * Errors returned by g_module_open_full().
84 *
85 * Since: 2.70
86 */
93
94/* return TRUE if dynamic module loading is supported */
97
98/* open a module 'file_name' and return handle, which is NULL on error */
100GModule* g_module_open (const gchar *file_name,
101 GModuleFlags flags);
102
105 GModuleFlags flags,
106 GError **error);
107
108/* close a previously opened module, returns TRUE on success */
111
112/* make a module resident so g_module_close on it will be ignored */
115
116/* query the last module error as a string */
118const gchar * g_module_error (void);
119
120/* retrieve a symbol pointer from 'module', returns TRUE on success */
123 const gchar *symbol_name,
124 gpointer *symbol);
125
126/* retrieve the file name from an existing module */
128const gchar * g_module_name (GModule *module);
129
130/* Build the actual file name containing a module. 'directory' is the
131 * directory where the module file is supposed to be, or NULL or empty
132 * in which case it should either be in the current directory or, on
133 * some operating systems, in some standard place, for instance on the
134 * PATH. Hence, to be absolutely sure to get the correct module,
135 * always pass in a directory. The file name consists of the directory,
136 * if supplied, and 'module_name' suitably decorated according to
137 * the operating system's conventions (for instance lib*.so or *.dll).
138 *
139 * No checks are made that the file exists, or is of correct type.
140 */
142gchar* g_module_build_path (const gchar *directory,
143 const gchar *module_name);
144
146
147#endif /* __GMODULE_H__ */
#define G_END_DECLS
Definition gmacros.h:910
#define G_BEGIN_DECLS
Definition gmacros.h:909
#define G_GNUC_CONST
Definition gmacros.h:637
#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_70
#define GMODULE_AVAILABLE_IN_2_70
#define GMODULE_DEPRECATED_IN_2_76
#define GMODULE_AVAILABLE_IN_ALL
GMODULE_AVAILABLE_IN_ALL const gchar * g_module_name(GModule *module)
GMODULE_AVAILABLE_IN_ALL gboolean g_module_supported(void) G_GNUC_CONST
GMODULE_DEPRECATED_IN_2_76 gchar * g_module_build_path(const gchar *directory, const gchar *module_name)
void(* GModuleUnload)(GModule *module)
Definition gmodule.h:72
GModuleError
Definition gmodule.h:88
@ G_MODULE_ERROR_CHECK_FAILED
Definition gmodule.h:90
@ G_MODULE_ERROR_FAILED
Definition gmodule.h:89
GMODULE_AVAILABLE_IN_ALL const gchar * g_module_error(void)
GMODULE_AVAILABLE_IN_ALL void g_module_make_resident(GModule *module)
GModuleFlags
Definition gmodule.h:64
@ G_MODULE_BIND_LOCAL
Definition gmodule.h:66
@ G_MODULE_BIND_LAZY
Definition gmodule.h:65
@ G_MODULE_BIND_MASK
Definition gmodule.h:67
GMODULE_AVAILABLE_IN_ALL gboolean g_module_symbol(GModule *module, const gchar *symbol_name, gpointer *symbol)
GMODULE_AVAILABLE_IN_2_70 GModule * g_module_open_full(const gchar *file_name, GModuleFlags flags, GError **error)
struct _GModule GModule
Definition gmodule.h:70
GMODULE_AVAILABLE_IN_2_70 GQuark g_module_error_quark(void)
GMODULE_AVAILABLE_IN_ALL gboolean g_module_close(GModule *module)
GMODULE_AVAILABLE_IN_ALL GModule * g_module_open(const gchar *file_name, GModuleFlags flags)
G_BEGIN_DECLS typedef guint32 GQuark
Definition gquark.h:38
gint gboolean
Definition gtypes.h:56
G_BEGIN_DECLS typedef char gchar
Definition gtypes.h:52
void * gpointer
Definition gtypes.h:109
static void error(LoadState *S, const char *why)