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:
- The suffix on macOS is usually
dylib
, but it'sso
when using Autotools, so there's no way to get the suffix correct using a pre-processor macro. - 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 iscyg
. - The library name itself can vary per platform. For instance, you may
want to load
foo-1.dll
on Windows andlibfoo.1.dylib
on macOS. This is for libraries, not modules, but that is still a use-case that people use theGModule
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 #520 (closed)
Closes #1413 (closed)