Skip to content

pixman-compiler.h: fix building tests with MinGW

MinGW supports __declspec(dllexport) but the current logic that sets PIXMAN_EXPORT only uses it when building with MSVC, leaving some symbols hidden when building with MinGW.

This results in an error when trying to link the tests:

FAILED: subprojects/pixman/test/combiner-test.exe
x86_64-w64-mingw32-gcc  -o subprojects/pixman/test/combiner-test.exe 'subprojects/pixman/test/f48fa9c@@combiner-test@exe/combiner-test.c.obj' -Wl,--allow-shlib-undefined -Wl,--start-group subprojects/pixman/test/libtestutils.a subprojects/pixman/pixman/libpixman-1.dll.a -pthread -fopenmp -fopenmp -lm -mconsole -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -Wl,--end-group
/usr/bin/x86_64-w64-mingw32-ld: subprojects/pixman/test/f48fa9c@@combiner-test@exe/combiner-test.c.obj: in function `main':
.../build/../subprojects/pixman/test/combiner-test.c:124: undefined reference to `_pixman_internal_only_get_implementation'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

By using PIXMAN_API also when building with MinGW, the tests can link successfully and the build succeed.

Tested with x86_64-w64-mingw32-gcc (GCC) 8.3-win32 20191201.

Edited by Antonio Ospite

Merge request reports