Commit Graph

10 Commits

Author SHA1 Message Date
Nirbheek Chauhan
d941558ee9 Improve g_module_open(), deprecate G_MODULE_SUFFIX
G_MODULE_SUFFIX is deprecated now because you will get the wrong
results using it most of the time:

1. The suffix on macOS is usually 'dylib', but it's 'so' when using
   Autotools, so there's no way to get the suffix correct using
   a pre-processor macro.
2. Prefixes also vary in a platform-specific way. You may or may not have
   a 'lib' prefix for the name on Windows and on Cygwin the prefix is
   'cyg'.
3. The library name itself can vary per platform. For instance, you may
   want to load foo-1.dll on Windows and libfoo.1.dylib on macOS. This
   is for libraries, not modules, but that is still a use-case that
   people use the GModule API for.

g_module_build_path() does take care of (2) on Cygwin, but it
fundamentally cannot handle the possibility of multiple options for
the module name, since it does not do any I/O. Hence, it is also
deprecated.

Instead, g_module_open() has been improved so that it takes care of
all this by searching the filesystem for combinations of possible
suffixes and prefixes on each platform. Along the way, the
documentation for it was also improved to make it clearer what it
does.

Closes https://gitlab.gnome.org/GNOME/glib/-/issues/520

Closes https://gitlab.gnome.org/GNOME/glib/-/issues/1413
2022-10-27 20:26:53 +05:30
Philip Withnall
26409f19cd Add SPDX license headers for LGPL-2.1-or-later to various files
These have all been added manually, as I’ve finished all the files which
I can automatically detect.

All the license headers in this commit are for LGPL-2.1-or-later, and
all have been double-checked against the license paragraph in the file
header.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #1415
2022-06-01 12:44:23 +01:00
nitinosiris
ee589aaa32 API: Add g_module_open_full()
g_module_open_full() is wrapper around g_module_open() function
which returns a GError in case of failure.

Closes #203
2021-07-21 21:45:51 +01:00
Patrick Welche
62f6c80e63 gmodule: change _g_module_close to only take a handle.
Since is_unref |= 1, the second argument, gboolean is_unref, has had
no effect.
2019-12-12 16:15:05 +00:00
Sébastien Wilmet
ca82612a6c gmodule/: LGPLv2+ -> LGPLv2.1+
https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-05-24 11:58:19 +02:00
Daniel Mustieles
078dbda148 Updated FSF's address 2014-01-31 14:31:55 +01:00
Matthias Clasen
9757456e23 Make header include order consistent (#71704, Diego Escalante Urrelo)
2007-11-07  Matthias Clasen <mclasen@redhat.com>

        * *.c: Make header include order consistent (#71704,
        Diego Escalante Urrelo)


svn path=/trunk/; revision=5817
2007-11-08 03:43:46 +00:00
Matthias Clasen
c888581c43 Include stdlib.h
2005-06-30  Matthias Clasen  <mclasen@redhat.com>

	* gmodule-ar.c: Include stdlib.h
2005-06-30 19:32:33 +00:00
Matthias Clasen
52e231144f Make it compile on AIX. (#141159, Michael Wilson)
Tue May 11 23:23:21 2004  Matthias Clasen  <maclas@gmx.de>

	* gmodule-ar.c (_g_module_open): Make it compile on AIX.
	(#141159, Michael Wilson)
2004-05-12 03:31:55 +00:00
Matthias Clasen
1c49b23e91 Set the gmodule suffix to 'a' for aix and use the aix gmodule
Sun Feb 22 02:28:43 2004  Matthias Clasen  <maclas@gmx.de>

	* configure.in: Set the gmodule suffix to 'a' for aix and
	use the aix gmodule implementation.  (#85930, Laurent Vivier)

	Bug #85930, Laurent Vivier:

	* gmodule-ar.c: Implementation of native module management for AIX.
	* gmoduleconf.h.in:
	* gmodule.c: Support gmodule-ar.c
2004-02-22 01:31:24 +00:00