1 /* GMODULE - GLIB wrapper code for dynamic module loading
2 * Copyright (C) 1998 Tim Janik
4 * SPDX-License-Identifier: LGPL-2.1-or-later
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.
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.
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/>.
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/.
38 #include <sys/types.h>
45 #include <io.h> /* For open() and close() prototypes. */
52 #include "gmoduleconf.h"
57 * @title: Dynamic Loading of Modules
58 * @short_description: portable method for dynamically loading 'plug-ins'
60 * These functions provide a portable way to dynamically load object files
61 * (commonly known as 'plug-ins'). The current implementation supports all
62 * systems that provide an implementation of dlopen() (e.g. Linux/Sun), as
63 * well as Windows platforms via DLLs.
65 * A program which wants to use these functions must be linked to the
66 * libraries output by the command `pkg-config --libs gmodule-2.0`.
68 * To use them you must first determine whether dynamic loading
69 * is supported on the platform by calling g_module_supported().
70 * If it is, you can open a module with g_module_open(),
71 * find the module's symbols (e.g. function names) with g_module_symbol(),
72 * and later close the module with g_module_close().
73 * g_module_name() will return the file name of a currently opened module.
75 * If any of the above functions fail, the error status can be found with
78 * The #GModule implementation features reference counting for opened modules,
79 * and supports hook functions within a module which are called when the
80 * module is loaded and unloaded (see #GModuleCheckInit and #GModuleUnload).
82 * If your module introduces static data to common subsystems in the running
83 * program, e.g. through calling
84 * `g_quark_from_static_string ("my-module-stuff")`,
85 * it must ensure that it is never unloaded, by calling g_module_make_resident().
87 * Example: Calling a function defined in a GModule
88 * |[<!-- language="C" -->
89 * // the function signature for 'say_hello'
90 * typedef void (* SayHelloFunc) (const char *message);
93 * just_say_hello (const char *filename, GError **error)
95 * SayHelloFunc say_hello;
98 * module = g_module_open (filename, G_MODULE_BIND_LAZY);
101 * g_set_error (error, FOO_ERROR, FOO_ERROR_BLAH,
102 * "%s", g_module_error ());
106 * if (!g_module_symbol (module, "say_hello", (gpointer *)&say_hello))
108 * g_set_error (error, SAY_ERROR, SAY_ERROR_OPEN,
109 * "%s: %s", filename, g_module_error ());
110 * if (!g_module_close (module))
111 * g_warning ("%s: %s", filename, g_module_error ());
115 * if (say_hello == NULL)
117 * g_set_error (error, SAY_ERROR, SAY_ERROR_OPEN,
118 * "symbol say_hello is NULL");
119 * if (!g_module_close (module))
120 * g_warning ("%s: %s", filename, g_module_error ());
124 * // call our function in the module
125 * say_hello ("Hello world!");
127 * if (!g_module_close (module))
128 * g_warning ("%s: %s", filename, g_module_error ());
137 * The #GModule struct is an opaque data structure to represent a
138 * [dynamically-loaded module][glib-Dynamic-Loading-of-Modules].
139 * It should only be accessed via the following functions.
144 * @module: the #GModule corresponding to the module which has just been loaded
146 * Specifies the type of the module initialization function.
147 * If a module contains a function named g_module_check_init() it is called
148 * automatically when the module is loaded. It is passed the #GModule structure
149 * and should return %NULL on success or a string describing the initialization
152 * Returns: %NULL on success, or a string describing the initialization error
157 * @module: the #GModule about to be unloaded
159 * Specifies the type of the module function called when it is unloaded.
160 * If a module contains a function named g_module_unload() it is called
161 * automatically when the module is unloaded.
162 * It is passed the #GModule structure.
168 * Expands to a shared library suffix for the current platform without the
169 * leading dot. On Unixes this is "so", and on Windows this is "dll".
171 * Deprecated: 2.76: Use g_module_open() instead with @module_name as the
172 * basename of the file_name argument. You will get the wrong results using
173 * this macro most of the time:
175 * 1. The suffix on macOS is usually 'dylib', but it's 'so' when using
176 * Autotools, so there's no way to get the suffix correct using
177 * a pre-processor macro.
178 * 2. Prefixes also vary in a platform-specific way. You may or may not have
179 * a 'lib' prefix for the name on Windows and on Cygwin the prefix is
181 * 3. The library name itself can vary per platform. For instance, you may
182 * want to load foo-1.dll on Windows and libfoo.1.dylib on macOS.
184 * g_module_open() takes care of all this by searching the filesystem for
185 * combinations of possible suffixes and prefixes.
191 * Used to declare functions exported by libraries or modules.
193 * When compiling for Windows, it marks the symbol as `dllexport`.
195 * When compiling for Linux and Unices, it marks the symbol as having `default`
196 * visibility. This is no-op unless the code is being compiled with a
198 * [visibility flag](https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#index-fvisibility-1260)
201 * This macro must only be used when compiling a shared module. Modules that
202 * support both shared and static linking should define their own macro that
203 * expands to %G_MODULE_EXPORT when compiling the shared module, but is empty
204 * when compiling the static module on Windows.
210 * Used to declare functions imported from modules.
213 /* We maintain a list of modules, so we can reference count them.
214 * That's needed because some platforms don't support references counts on
215 * modules. Also, the module for the program itself is kept separately for
216 * faster access and because it has special semantics.
220 /* --- structures --- */
225 guint ref_count : 31;
226 guint is_resident : 1;
227 GModuleUnload unload;
232 /* --- prototypes --- */
233 static gpointer _g_module_open (const gchar *file_name,
237 static void _g_module_close (gpointer handle);
238 static gpointer _g_module_self (void);
239 static gpointer _g_module_symbol (gpointer handle,
240 const gchar *symbol_name);
241 #if (G_MODULE_IMPL != G_MODULE_IMPL_DL) && (G_MODULE_IMPL != G_MODULE_IMPL_AR)
242 static gchar* _g_module_build_path (const gchar *directory,
243 const gchar *module_name);
245 /* Implementation is in gmodule-deprecated.c */
246 gchar* _g_module_build_path (const gchar *directory,
247 const gchar *module_name);
249 static inline void g_module_set_error (const gchar *error);
250 static inline GModule* g_module_find_by_handle (gpointer handle);
251 static inline GModule* g_module_find_by_name (const gchar *name);
254 /* --- variables --- */
255 static GModule *modules = NULL;
256 static GModule *main_module = NULL;
257 static GPrivate module_error_private = G_PRIVATE_INIT (g_free);
258 static gboolean module_debug_initialized = FALSE;
259 static guint module_debug_flags = 0;
262 /* --- inline functions --- */
263 static inline GModule*
264 g_module_find_by_handle (gpointer handle)
267 GModule *retval = NULL;
269 if (main_module && main_module->handle == handle)
270 retval = main_module;
272 for (module = modules; module; module = module->next)
273 if (handle == module->handle)
282 static inline GModule*
283 g_module_find_by_name (const gchar *name)
286 GModule *retval = NULL;
288 for (module = modules; module; module = module->next)
289 if (strcmp (name, module->file_name) == 0)
299 g_module_set_error_unduped (gchar *error)
301 g_private_replace (&module_error_private, error);
306 g_module_set_error (const gchar *error)
308 g_module_set_error_unduped (g_strdup (error));
312 /* --- include platform specific code --- */
313 #define SUPPORT_OR_RETURN(rv) { g_module_set_error (NULL); }
314 #if (G_MODULE_IMPL == G_MODULE_IMPL_DL)
315 #include "gmodule-dl.c"
316 #elif (G_MODULE_IMPL == G_MODULE_IMPL_WIN32)
317 #include "gmodule-win32.c"
318 #elif (G_MODULE_IMPL == G_MODULE_IMPL_AR)
319 #include "gmodule-ar.c"
321 #undef SUPPORT_OR_RETURN
322 #define SUPPORT_OR_RETURN(rv) { g_module_set_error ("dynamic modules are " \
323 "not supported by this system"); return rv; }
325 _g_module_open (const gchar *file_name,
330 g_module_set_error (NULL);
334 _g_module_close (gpointer handle)
338 _g_module_self (void)
343 _g_module_symbol (gpointer handle,
344 const gchar *symbol_name)
349 _g_module_build_path (const gchar *directory,
350 const gchar *module_name)
354 #endif /* no implementation */
359 * The error domain of the #GModule API.
363 G_DEFINE_QUARK (g-module-error-quark, g_module_error)
365 /* --- functions --- */
368 * g_module_supported:
370 * Checks if modules are supported on the current platform.
372 * Returns: %TRUE if modules are supported
375 g_module_supported (void)
377 SUPPORT_OR_RETURN (FALSE);
383 parse_libtool_archive (const gchar* libtool_name)
385 const guint TOKEN_DLNAME = G_TOKEN_LAST + 1;
386 const guint TOKEN_INSTALLED = G_TOKEN_LAST + 2;
387 const guint TOKEN_LIBDIR = G_TOKEN_LAST + 3;
388 gchar *lt_dlname = NULL;
389 gboolean lt_installed = TRUE;
390 gchar *lt_libdir = NULL;
395 int fd = g_open (libtool_name, O_RDONLY | O_CLOEXEC, 0);
398 gchar *display_libtool_name = g_filename_display_name (libtool_name);
399 g_module_set_error_unduped (g_strdup_printf ("failed to open libtool archive ‘%s’", display_libtool_name));
400 g_free (display_libtool_name);
403 /* search libtool's dlname specification */
404 scanner = g_scanner_new (NULL);
405 g_scanner_input_file (scanner, fd);
406 scanner->config->symbol_2_token = TRUE;
407 g_scanner_scope_add_symbol (scanner, 0, "dlname",
408 GUINT_TO_POINTER (TOKEN_DLNAME));
409 g_scanner_scope_add_symbol (scanner, 0, "installed",
410 GUINT_TO_POINTER (TOKEN_INSTALLED));
411 g_scanner_scope_add_symbol (scanner, 0, "libdir",
412 GUINT_TO_POINTER (TOKEN_LIBDIR));
413 while (!g_scanner_eof (scanner))
415 token = g_scanner_get_next_token (scanner);
416 if (token == TOKEN_DLNAME || token == TOKEN_INSTALLED ||
417 token == TOKEN_LIBDIR)
419 if (g_scanner_get_next_token (scanner) != '=' ||
420 g_scanner_get_next_token (scanner) !=
421 (token == TOKEN_INSTALLED ?
422 G_TOKEN_IDENTIFIER : G_TOKEN_STRING))
424 gchar *display_libtool_name = g_filename_display_name (libtool_name);
425 g_module_set_error_unduped (g_strdup_printf ("unable to parse libtool archive ‘%s’", display_libtool_name));
426 g_free (display_libtool_name);
430 g_scanner_destroy (scanner);
437 if (token == TOKEN_DLNAME)
440 lt_dlname = g_strdup (scanner->value.v_string);
442 else if (token == TOKEN_INSTALLED)
444 strcmp (scanner->value.v_identifier, "yes") == 0;
445 else /* token == TOKEN_LIBDIR */
448 lt_libdir = g_strdup (scanner->value.v_string);
456 gchar *dir = g_path_get_dirname (libtool_name);
458 lt_libdir = g_strconcat (dir, G_DIR_SEPARATOR_S ".libs", NULL);
462 g_clear_pointer (&scanner, g_scanner_destroy);
463 close (g_steal_fd (&fd));
465 if (lt_libdir == NULL || lt_dlname == NULL)
467 gchar *display_libtool_name = g_filename_display_name (libtool_name);
468 g_module_set_error_unduped (g_strdup_printf ("unable to parse libtool archive ‘%s’", display_libtool_name));
469 g_free (display_libtool_name);
474 name = g_strconcat (lt_libdir, G_DIR_SEPARATOR_S, lt_dlname, NULL);
484 G_MODULE_DEBUG_RESIDENT_MODULES = 1 << 0,
485 G_MODULE_DEBUG_BIND_NOW_MODULES = 1 << 1
489 _g_module_debug_init (void)
491 const GDebugKey keys[] = {
492 { "resident-modules", G_MODULE_DEBUG_RESIDENT_MODULES },
493 { "bind-now-modules", G_MODULE_DEBUG_BIND_NOW_MODULES }
497 env = g_getenv ("G_DEBUG");
500 !env ? 0 : g_parse_debug_string (env, keys, G_N_ELEMENTS (keys));
502 module_debug_initialized = TRUE;
505 static GRecMutex g_module_global_lock;
508 * g_module_open_full:
509 * @file_name: (nullable): the name or path to the file containing the module,
510 * or %NULL to obtain a #GModule representing the main program itself
511 * @flags: the flags used for opening the module. This can be the
512 * logical OR of any of the #GModuleFlags
515 * Opens a module. If the module has already been opened, its reference count
516 * is incremented. If not, the module is searched in the following order:
518 * 1. If @file_name exists as a regular file, it is used as-is; else
519 * 2. If @file_name doesn't have the correct suffix and/or prefix for the
520 * platform, then possible suffixes and prefixes will be added to the
521 * basename till a file is found and whatever is found will be used; else
522 * 3. If @file_name doesn't have the ".la"-suffix, ".la" is appended. Either
523 * way, if a matching .la file exists (and is a libtool archive) the
524 * libtool archive is parsed to find the actual file name, and that is
527 * At the end of all this, we would have a file path that we can access on
528 * disk, and it is opened as a module. If not, @file_name is opened as
529 * a module verbatim in the hopes that the system implementation will somehow
530 * be able to access it.
532 * Returns: a #GModule on success, or %NULL on failure
537 g_module_open_full (const gchar *file_name,
542 gpointer handle = NULL;
545 SUPPORT_OR_RETURN (NULL);
547 g_return_val_if_fail (error == NULL || *error == NULL, NULL);
549 g_rec_mutex_lock (&g_module_global_lock);
551 if (G_UNLIKELY (!module_debug_initialized))
552 _g_module_debug_init ();
554 if (module_debug_flags & G_MODULE_DEBUG_BIND_NOW_MODULES)
555 flags &= ~G_MODULE_BIND_LAZY;
561 handle = _g_module_self ();
562 /* On Android 64 bit, RTLD_DEFAULT is (void *)0x0
563 * so it always fails to create main_module if file_name is NULL */
564 #if !defined(__BIONIC__) || !defined(__LP64__)
568 main_module = g_new (GModule, 1);
569 main_module->file_name = NULL;
570 main_module->handle = handle;
571 main_module->ref_count = 1;
572 main_module->is_resident = TRUE;
573 main_module->unload = NULL;
574 main_module->next = NULL;
578 main_module->ref_count++;
580 g_rec_mutex_unlock (&g_module_global_lock);
584 /* we first search the module list by name */
585 module = g_module_find_by_name (file_name);
590 g_rec_mutex_unlock (&g_module_global_lock);
594 /* check whether we have a readable file right away */
595 if (g_file_test (file_name, G_FILE_TEST_IS_REGULAR))
596 name = g_strdup (file_name);
597 /* try completing file name with standard library suffix */
600 char *basename, *dirname;
601 size_t prefix_idx = 0, suffix_idx = 0;
602 const char *prefixes[2] = {0}, *suffixes[2] = {0};
604 basename = g_path_get_basename (file_name);
605 dirname = g_path_get_dirname (file_name);
607 if (!g_str_has_prefix (basename, "lib"))
608 prefixes[prefix_idx++] = "lib";
609 prefixes[prefix_idx++] = "";
610 if (!g_str_has_suffix (basename, ".dll"))
611 suffixes[suffix_idx++] = ".dll";
614 if (!g_str_has_prefix (basename, "cyg"))
615 prefixes[prefix_idx++] = "cyg";
617 if (!g_str_has_prefix (basename, "lib"))
618 prefixes[prefix_idx++] = "lib";
620 /* People commonly pass `libfoo` as the file_name and want us to
621 * auto-detect the suffix as .la or .so, etc. We need to also find
622 * .dylib and .dll in those cases. */
623 prefixes[prefix_idx++] = "";
626 if (!g_str_has_suffix (basename, ".dylib") &&
627 !g_str_has_suffix (basename, ".so"))
629 suffixes[suffix_idx++] = ".dylib";
630 suffixes[suffix_idx++] = ".so";
633 if (!g_str_has_suffix (basename, ".so"))
634 suffixes[suffix_idx++] = ".so";
637 for (guint i = 0; i < prefix_idx; i++)
639 for (guint j = 0; j < suffix_idx; j++)
641 name = g_strconcat (dirname, G_DIR_SEPARATOR_S, prefixes[i],
642 basename, suffixes[j], NULL);
643 if (g_file_test (name, G_FILE_TEST_IS_REGULAR))
653 /* try completing by appending libtool suffix */
656 name = g_strconcat (file_name, ".la", NULL);
657 if (!g_file_test (name, G_FILE_TEST_IS_REGULAR))
663 /* we can't access() the file, lets hope the platform backends finds
664 * it via library paths
668 gchar *dot = strrchr (file_name, '.');
669 gchar *slash = strrchr (file_name, G_DIR_SEPARATOR);
671 /* we make sure the name has a suffix using the deprecated
672 * G_MODULE_SUFFIX for backward-compat */
673 if (!dot || dot < slash)
674 name = g_strconcat (file_name, "." G_MODULE_SUFFIX, NULL);
676 name = g_strdup (file_name);
679 /* ok, try loading the module */
680 g_assert (name != NULL);
682 /* if it's a libtool archive, figure library file to load */
683 if (g_str_has_suffix (name, ".la")) /* libtool archive? */
685 gchar *real_name = parse_libtool_archive (name);
687 /* real_name might be NULL, but then module error is already set */
695 handle = _g_module_open (name, (flags & G_MODULE_BIND_LAZY) != 0,
696 (flags & G_MODULE_BIND_LOCAL) != 0, error);
702 GModuleCheckInit check_init;
703 const gchar *check_failed = NULL;
705 /* search the module list by handle, since file names are not unique */
706 module = g_module_find_by_handle (handle);
709 _g_module_close (module->handle);
711 g_module_set_error (NULL);
713 g_rec_mutex_unlock (&g_module_global_lock);
717 saved_error = g_strdup (g_module_error ());
718 g_module_set_error (NULL);
720 module = g_new (GModule, 1);
721 module->file_name = g_strdup (file_name);
722 module->handle = handle;
723 module->ref_count = 1;
724 module->is_resident = FALSE;
725 module->unload = NULL;
726 module->next = modules;
729 /* check initialization */
730 if (g_module_symbol (module, "g_module_check_init", (gpointer) &check_init) && check_init != NULL)
731 check_failed = check_init (module);
733 /* we don't call unload() if the initialization check failed. */
735 g_module_symbol (module, "g_module_unload", (gpointer) &module->unload);
741 temp_error = g_strconcat ("GModule (", file_name, ") ",
742 "initialization check failed: ",
744 g_module_close (module);
746 g_module_set_error (temp_error);
747 g_set_error_literal (error, G_MODULE_ERROR, G_MODULE_ERROR_CHECK_FAILED, temp_error);
751 g_module_set_error (saved_error);
753 g_free (saved_error);
756 if (module != NULL &&
757 (module_debug_flags & G_MODULE_DEBUG_RESIDENT_MODULES))
758 g_module_make_resident (module);
760 g_rec_mutex_unlock (&g_module_global_lock);
766 * @file_name: (nullable): the name or path to the file containing the module,
767 * or %NULL to obtain a #GModule representing the main program itself
768 * @flags: the flags used for opening the module. This can be the
769 * logical OR of any of the #GModuleFlags.
771 * A thin wrapper function around g_module_open_full()
773 * Returns: a #GModule on success, or %NULL on failure
776 g_module_open (const gchar *file_name,
779 return g_module_open_full (file_name, flags, NULL);
784 * @module: a #GModule to close
788 * Returns: %TRUE on success
791 g_module_close (GModule *module)
793 SUPPORT_OR_RETURN (FALSE);
795 g_return_val_if_fail (module != NULL, FALSE);
796 g_return_val_if_fail (module->ref_count > 0, FALSE);
798 g_rec_mutex_lock (&g_module_global_lock);
802 if (!module->ref_count && !module->is_resident && module->unload)
804 GModuleUnload unload;
806 unload = module->unload;
807 module->unload = NULL;
811 if (!module->ref_count && !module->is_resident)
824 last->next = node->next;
826 modules = node->next;
834 _g_module_close (module->handle);
835 g_free (module->file_name);
839 g_rec_mutex_unlock (&g_module_global_lock);
840 return g_module_error() == NULL;
844 * g_module_make_resident:
845 * @module: a #GModule to make permanently resident
847 * Ensures that a module will never be unloaded.
848 * Any future g_module_close() calls on the module will be ignored.
851 g_module_make_resident (GModule *module)
853 g_return_if_fail (module != NULL);
855 module->is_resident = TRUE;
861 * Gets a string describing the last module error.
863 * Returns: a string describing the last module error
866 g_module_error (void)
868 return g_private_get (&module_error_private);
873 * @module: a #GModule
874 * @symbol_name: the name of the symbol to find
875 * @symbol: (out): returns the pointer to the symbol value
877 * Gets a symbol pointer from a module, such as one exported
878 * by %G_MODULE_EXPORT. Note that a valid symbol can be %NULL.
880 * Returns: %TRUE on success
883 g_module_symbol (GModule *module,
884 const gchar *symbol_name,
887 const gchar *module_error;
891 SUPPORT_OR_RETURN (FALSE);
893 g_return_val_if_fail (module != NULL, FALSE);
894 g_return_val_if_fail (symbol_name != NULL, FALSE);
895 g_return_val_if_fail (symbol != NULL, FALSE);
897 g_rec_mutex_lock (&g_module_global_lock);
899 #ifdef G_MODULE_NEED_USCORE
903 name = g_strconcat ("_", symbol_name, NULL);
904 *symbol = _g_module_symbol (module->handle, name);
907 #else /* !G_MODULE_NEED_USCORE */
908 *symbol = _g_module_symbol (module->handle, symbol_name);
909 #endif /* !G_MODULE_NEED_USCORE */
911 module_error = g_module_error ();
916 error = g_strconcat ("'", symbol_name, "': ", module_error, NULL);
917 g_module_set_error (error);
922 g_rec_mutex_unlock (&g_module_global_lock);
923 return !module_error;
928 * @module: a #GModule
930 * Returns the filename that the module was opened with.
932 * If @module refers to the application itself, "main" is returned.
934 * Returns: (transfer none): the filename of the module
937 g_module_name (GModule *module)
939 g_return_val_if_fail (module != NULL, NULL);
941 if (module == main_module)
944 return module->file_name;
948 * g_module_build_path:
949 * @directory: (nullable): the directory where the module is. This can be
950 * %NULL or the empty string to indicate that the standard platform-specific
951 * directories will be used, though that is not recommended
952 * @module_name: the name of the module
954 * A portable way to build the filename of a module. The platform-specific
955 * prefix and suffix are added to the filename, if needed, and the result
956 * is added to the directory, using the correct separator character.
958 * The directory should specify the directory where the module can be found.
959 * It can be %NULL or an empty string to indicate that the module is in a
960 * standard platform-specific directory, though this is not recommended
961 * since the wrong module may be found.
963 * For example, calling g_module_build_path() on a Linux system with a
964 * @directory of `/lib` and a @module_name of "mylibrary" will return
965 * `/lib/libmylibrary.so`. On a Windows system, using `\Windows` as the
966 * directory it will return `\Windows\mylibrary.dll`.
968 * Returns: the complete path of the module, including the standard library
969 * prefix and suffix. This should be freed when no longer needed
971 * Deprecated: 2.76: Use g_module_open() instead with @module_name as the
972 * basename of the file_name argument. See %G_MODULE_SUFFIX for why.
975 g_module_build_path (const gchar *directory,
976 const gchar *module_name)
978 g_return_val_if_fail (module_name != NULL, NULL);
980 return _g_module_build_path (directory, module_name);
986 /* Binary compatibility versions. Not for newly compiled code. */
988 _GMODULE_EXTERN GModule * g_module_open_utf8 (const gchar *file_name,
991 _GMODULE_EXTERN const gchar *g_module_name_utf8 (GModule *module);
994 g_module_open_utf8 (const gchar *file_name,
997 return g_module_open (file_name, flags);
1001 g_module_name_utf8 (GModule *module)
1003 return g_module_name (module);