]> granicus.if.org Git - graphviz/commitdiff
common: ensure correct import/export declarations of expat with MinGW
authorMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Thu, 29 Jul 2021 16:31:12 +0000 (18:31 +0200)
committerMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Tue, 31 Aug 2021 15:45:43 +0000 (17:45 +0200)
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'

lib/common/htmllex.c

index a6a347e78fe900c2ce1f585fee380bb315bebc0d..1089c59dceb507c02c0643ba48d29be5d913902c 100644 (file)
 #include <stddef.h>
 
 #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 <expat.h>
 #endif