Re: [xml] Building libxml2 as a DLL under MinGW MSYS

As far as I can tell, Mingw needs to export/import the global data to
work correctly with DLL's. I added this to config.h to allow the build
of xmllint and the test programs:

#define LIBXML_DLL_IMPORT  __declspec(dllexport)
#define LIBXML_DLL_IMPORT  __declspec(dllimport)

config.h may not be the best place for these to go but I was just
trying to make the xmllint et. al. compile.

Perhaps we should place these somewhere where all compilers can access it.
All compilers see it in front of every public variable declaration and all
preprocessors must expand it to something, or remove it.

One thing: The name 'LIBXML_DLL_EXPORT' is somewhat misleading. An user who
has never seen Windows rightfully asks herself what that should be. Should
this thing ever be used more than now, I would urge to rename it to
something more understandable, such as LIBXML_PUBLIC, for example.

Whatever its name, putting it in front of every function's declaration is
unlikely to happen. Only Windows can profit from this and all other
platforms would have to endure a header uglification. We had discussed about
this a while ago. There is a hard resistance at least as long as there is an

The deal is that mingw needs the global *data* to be wrapped with the
__declspec(dllexport | dllimport) and to the best of my understanding
the functions are not nearly as big of a deal and do not need them.

Mingw needs (dllexport)? I thought it is the same as MSVC in that manner. A
DLL can export a variable without (dllexport), but the client code such as
xmllint cannot import it without (dllimport). Functions can be exported an
imported without these. C++ classes can not be exported without (dllexport)
but can be imported without (dllimport). What a mess.

Any objections, suggestions, cries, cheers?

I think you are doing a wonderful job and thank you for your
consideration of those, like myself, who like using mingw.

Was that a cry or a cheer? :-) Seriously, I appreciate it, but there is no
need to thank me for that. No sane soul would ever drive the support for her
own platform with ignorance towards any other platform, regardless now small
the number of its users. Even if I would do that, I would be stopped by the
others one way or another. Daniel has equally considered your platform,
although he has absolutely no use for Windows or mingw. That is not a simple
courtesy, it is our duty, it is what we want, and it is the only way we can
go no matter what we want. That is the democracy of the Open Source and
precisely the politics responsible for today's libxml, one of the world's
very best XML processors... ah cut that crap, is the beer cold allready?
It's saturday evening :-)


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