From: Magnus Jacobsson Date: Thu, 29 Jul 2021 16:31:12 +0000 (+0200) Subject: common: ensure correct import/export declarations of expat with MinGW X-Git-Tag: 2.49.1~51^2~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b2d2a6d30bf3406df02f3564d64779200a1bc5a8;p=graphviz common: ensure correct import/export declarations of expat with MinGW The expat library does not seem to recognize MinGW and therefore does not apply the Microsoft storage class attributes to its function declarations when using MinGW. Defining XML_USE_MSC_EXTENSIONS forces it to use those. Fixes errors like this with MinGW: C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../common/CMakeFiles/common_obj.dir/htmllex.c.obj:htmllex.c:(.text+0x1cec): undefined reference to `XML_ParserCreate' --- diff --git a/lib/common/htmllex.c b/lib/common/htmllex.c index a6a347e78..1089c59dc 100644 --- a/lib/common/htmllex.c +++ b/lib/common/htmllex.c @@ -20,6 +20,11 @@ #include #ifdef HAVE_EXPAT +#ifdef _WIN32 +// ensure that the expat functions get the correct storage class +// declarations also on MinGW +#define XML_USE_MSC_EXTENSIONS 1 +#endif #include #endif