g_module_build_path builds incorrect paths on macOS and Windows (MSVC)
@chm.duquesne
Submitted by Christophe-Marie Duquesne Link to original bug (#671212)
Description
In the documentation 1, it is specified that g_module_build_path is a portable way to build the file name of a module: the platform-specific prefix and suffix are added to the filename, if needed. The example given makes it clear:
"For example, calling g_module_build_path() on a Linux system with a directory of /lib and a module_name of "mylibrary" will return /lib/libmylibrary.so. On a Windows system, using \Windows as the directory it will return \Windows\mylibrary.dll."
However, this turns out to be false.
Using the windows build, the following code
g_module_build_path(NULL, "foo");
returns libfoo.dll (and not foo.dll).
Attached is an archive with minimal code to illustrate the bug.
Version: 2.28.x