Re: [xml] global variables in globals.h



LRN wrote:
I'm trying to build libxml2 from source (git), and linker keeps
complaining about multiple definition of variables between SAX.c and
other source files, like this:
.libs/entities.o: In function `xmlDumpEntityContent':
f:\src\libxml2/entities.c:879: multiple definition of `forbiddenExp'
.libs/SAX.o:f:\src\libxml2/SAX.c:43: first defined here
because both SAX.c and entities.c (in this particular example) define
IN_LIBXML and include various headers (such as global.h, xmlregexp.h and
other)
According to xmlexports.h, when LIBXML_STATIC is not defined (in my case
it definitely isn't) and IN_LIBXML is defined (it is, see above),
XMLPUBVAR is defined as
     #define XMLPUBVAR __declspec(dllexport)
Interestingly, for Borland compiler XMLPUBVAR is defined as
     #define XMLPUBVAR __declspec(dllexport) extern
and changing MinGW section to use the same definition fixes multiple
definition errors for me.

LRN report privately that compiler flag -fno-common break linking. The proposed patch fix issue.

May be cygwin build is impacted too.

Roumen



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]