summaryrefslogtreecommitdiff
path: root/gmodule
diff options
context:
space:
mode:
authorKarol Lewandowski <k.lewandowsk@samsung.com>2024-09-03 09:34:57 +0200
committerKarol Lewandowski <k.lewandowsk@samsung.com>2024-09-03 09:34:57 +0200
commit52511d42630b62ba3d304cd18c0b5ab67ab8544f (patch)
tree9041c7c86ee03eae7cab9f28c330b5b68a8bb82a /gmodule
parentcbf799e5a01a2250bae43515fd8afffcb6239dc0 (diff)
downloadglib-52511d42630b62ba3d304cd18c0b5ab67ab8544f.tar.gz
glib-52511d42630b62ba3d304cd18c0b5ab67ab8544f.tar.bz2
glib-52511d42630b62ba3d304cd18c0b5ab67ab8544f.zip
Imported Upstream version 2.79.0upstream/2.79.0
Diffstat (limited to 'gmodule')
-rw-r--r--gmodule/gmodule-dl.c4
-rw-r--r--gmodule/gmodule.c78
-rw-r--r--gmodule/meson.build3
3 files changed, 4 insertions, 81 deletions
diff --git a/gmodule/gmodule-dl.c b/gmodule/gmodule-dl.c
index 81b1b9f6b..85062d038 100644
--- a/gmodule/gmodule-dl.c
+++ b/gmodule/gmodule-dl.c
@@ -167,7 +167,7 @@ _g_module_self (void)
* NULL is given, dlsym returns an appropriate pointer.
*/
lock_dlerror ();
-#if defined(__BIONIC__) || defined(__NetBSD__)
+#if defined(__BIONIC__) || defined(__NetBSD__) || defined(__FreeBSD__)
handle = RTLD_DEFAULT;
#else
handle = dlopen (NULL, RTLD_GLOBAL | RTLD_LAZY);
@@ -182,7 +182,7 @@ _g_module_self (void)
static void
_g_module_close (gpointer handle)
{
-#if defined(__BIONIC__) || defined(__NetBSD__)
+#if defined(__BIONIC__) || defined(__NetBSD__) || defined(__FreeBSD__)
if (handle != RTLD_DEFAULT)
#endif
{
diff --git a/gmodule/gmodule.c b/gmodule/gmodule.c
index aafaaf0ad..87f67846a 100644
--- a/gmodule/gmodule.c
+++ b/gmodule/gmodule.c
@@ -52,84 +52,6 @@
#include "gmoduleconf.h"
#include "gstdio.h"
-/**
- * SECTION:modules
- * @title: Dynamic Loading of Modules
- * @short_description: portable method for dynamically loading 'plug-ins'
- *
- * These functions provide a portable way to dynamically load object files
- * (commonly known as 'plug-ins'). The current implementation supports all
- * systems that provide an implementation of dlopen() (e.g. Linux/Sun), as
- * well as Windows platforms via DLLs.
- *
- * A program which wants to use these functions must be linked to the
- * libraries output by the command `pkg-config --libs gmodule-2.0`.
- *
- * To use them you must first determine whether dynamic loading
- * is supported on the platform by calling g_module_supported().
- * If it is, you can open a module with g_module_open(),
- * find the module's symbols (e.g. function names) with g_module_symbol(),
- * and later close the module with g_module_close().
- * g_module_name() will return the file name of a currently opened module.
- *
- * If any of the above functions fail, the error status can be found with
- * g_module_error().
- *
- * The #GModule implementation features reference counting for opened modules,
- * and supports hook functions within a module which are called when the
- * module is loaded and unloaded (see #GModuleCheckInit and #GModuleUnload).
- *
- * If your module introduces static data to common subsystems in the running
- * program, e.g. through calling
- * `g_quark_from_static_string ("my-module-stuff")`,
- * it must ensure that it is never unloaded, by calling g_module_make_resident().
- *
- * Example: Calling a function defined in a GModule
- * |[<!-- language="C" -->
- * // the function signature for 'say_hello'
- * typedef void (* SayHelloFunc) (const char *message);
- *
- * gboolean
- * just_say_hello (const char *filename, GError **error)
- * {
- * SayHelloFunc say_hello;
- * GModule *module;
- *
- * module = g_module_open (filename, G_MODULE_BIND_LAZY);
- * if (!module)
- * {
- * g_set_error (error, FOO_ERROR, FOO_ERROR_BLAH,
- * "%s", g_module_error ());
- * return FALSE;
- * }
- *
- * if (!g_module_symbol (module, "say_hello", (gpointer *)&say_hello))
- * {
- * g_set_error (error, SAY_ERROR, SAY_ERROR_OPEN,
- * "%s: %s", filename, g_module_error ());
- * if (!g_module_close (module))
- * g_warning ("%s: %s", filename, g_module_error ());
- * return FALSE;
- * }
- *
- * if (say_hello == NULL)
- * {
- * g_set_error (error, SAY_ERROR, SAY_ERROR_OPEN,
- * "symbol say_hello is NULL");
- * if (!g_module_close (module))
- * g_warning ("%s: %s", filename, g_module_error ());
- * return FALSE;
- * }
- *
- * // call our function in the module
- * say_hello ("Hello world!");
- *
- * if (!g_module_close (module))
- * g_warning ("%s: %s", filename, g_module_error ());
- * return TRUE;
- * }
- * ]|
- */
/**
* GModule:
diff --git a/gmodule/meson.build b/gmodule/meson.build
index da4d06cfb..bbe0a08c0 100644
--- a/gmodule/meson.build
+++ b/gmodule/meson.build
@@ -65,6 +65,7 @@ gmoduleconf_h = configure_file(input : 'gmoduleconf.h.in',
# when it includes GLib as a subproject
gmodule_h = files('gmodule.h')
gmodule_c = files('gmodule.c')
+gmodule_deprecated_c = files('gmodule-deprecated.c')
install_headers([gmodule_h], install_dir : glib_includedir)
@@ -77,7 +78,7 @@ gmodule_visibility_h = custom_target(
install_tag: 'devel',
)
-gmodule_sources = [gmodule_c, gmodule_visibility_h, 'gmodule-deprecated.c']
+gmodule_sources = [gmodule_c, gmodule_visibility_h, gmodule_deprecated_c]
if host_system == 'windows'
gmodule_win_rc = configure_file(