Re: [xml] undefined reference to `_imp__xmlFree' error on mingw with msys for 2.6.5
- From: Igor Zlatkovic <igor zlatkovic com>
- To: Mikhail S Grushinskiy <mgrushinskiy comcast net>
- Cc: xml gnome org
- Subject: Re: [xml] undefined reference to `_imp__xmlFree' error on mingw with msys for 2.6.5
- Date: Mon, 02 Feb 2004 11:23:19 +0100
Mikhail S Grushinskiy wrote:
The problem fixes if I remove defined(IN_LIBXML) condition in xmlexports.h
Not sure why it is needed, but without it everything compiles fine on mingw
with msys.
/* Windows platform with GNU compiler (Mingw) */
#if defined(_WIN32) && defined(__MINGW32__)
#undef XMLPUBFUN
#undef XMLPUBVAR
#undef XMLCALL
/*
#if defined(IN_LIBXML) && !defined(LIBXML_STATIC)
*/
#if !defined(LIBXML_STATIC)
#define XMLPUBFUN __declspec(dllexport)
#define XMLPUBVAR __declspec(dllexport) extern
#else
#define XMLPUBFUN
#if !defined(LIBXML_STATIC)
#define XMLPUBVAR __declspec(dllimport) extern
#else
#define XMLPUBVAR extern
#endif
#endif
#define XMLCALL __cdecl
#if !defined _REENTRANT
#define _REENTRANT
#endif
#endif
That IN_LIBXML is used to determine wether libxml itself is being
compiled, or some app which uses libxml. In the former case, symbols
should be exported. In the latter, they should be imported.
The net effect of your doing is:
#define XMLPUBFUN __declspec(dllexport)
#define XMLPUBVAR __declspec(dllexport) extern
#define XMLCALL __cdecl
The macro LIBXML_STATIC is never defined when using libtool. Only the
makefiles in win32/ define this.
Now when an application using libxml2 (xmllint for example) includes
libxml headers, it gets instructed to reexport libxml symbols. This
results in few inconsistencies, but GCC seems to expect these and it
handles them.
If I define the mongw block like this:
#if defined(_WIN32) && defined(__MINGW32__)
#define XMLPUBFUN
#ifdef __cplusplus
#define XMLPUBVAR extern
#else
#define XMLPUBVAR
#endif
#if !defined _REENTRANT
#define _REENTRANT
#endif
#endif
I get best results without msys. Now everything links without a single
frown. Can you please try that?
Ciao,
Igor
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]