Skip to content

glib-compile-resources: Fix exporting on Visual Studio

Chun-wei Fan requested to merge fix-gresource-export-msvc into master

Hi,

When trying to add Visual Studio build support for libpeas, I have come into a problem where the symbols that are in the generated GResource C sources are not really exported although it is requested that they are exported, because we only have an extern annotation in the generated sources, which is not enough for Visual Studio-style compilers to export such symbols.

So, this attempts to fix this by putting the prefix:

#if defined (G_OS_WIN32) && defined (_MSC_VER)
__declspec(dllexport)
#endif

before the extern in the generated functions in the generated C sources (not headers, as they are not really included by the generated C sources), unless we are using the --internal option.

Since this only affects individual generated sources, I think we do not need to define macros for this.

This MR will apply to both master and glib-2-64 and earlier.

With blessings, thank you!

Fixes: #1215 (closed)

Edited by Philip Withnall

Merge request reports