[xml] 64 bit xml2 with gcc



Dear libxml list,

I am using libxml2 in a project, and am having some troubles with the win64 build.

I have tried using the tdm-gcc to build libxml2. This is fine under win32 -- a dll is generated, and everyone 
is happy.

Now, when I try building libxml2 with tdm-gcc64, I get an error about undefined _imp_xmlFree and friends -- 
this look suspiciously like this post here:
http://mail.gnome.org/archives/xml/2009-November/msg00005.html

These errors "go away" if I change  the ifdef on line 116 of xmlexports.h (below the workaround comment) to 
ifdef 1.

Now, when I do that, a static library is built, even with --enable-shared. I then try to build a small test C 
that calls xmlCreateContext, and this works.

When I try to build my larger C++ program, I get an error about multiple definitions of _imp_xmlFree and 
friends. I can only build an .exe if I add -Wl,--allow-multiple to the command line.

Thats all fine, until I try to call xmlCreateContext (or any libxml2 function) from my program -- this 
triggers an instant crash.

I tried many things, such as changing XMLCALL to use  __declspec(dllexport),  but at this point I must admit 
I have no idea what I am doing.

So my questions are:


* Are there any reliable win64 binaries +header built with gcc? The libxml2 homepage only links to some 3rd 
party 32 bit ones.
* Any suggestions on why I am getting multiple definitions? I can't seem to cut a program out of my larger 
program that produces this. Why is this working with a small C program (even with multiple .o files, each 
calling a single function containing xmlCreateContext)?
* Why, if I have a static lib, would I be getting crashes if the linking was successful??
* Is it worth trying to build a shared lib? I tried playing with a2dll, and peppering -W,-shared  into the 
Makfiles, but ultimately got nowhere.
* Is there a way past this using gcc? Visual studio is not an option as this is for a free program, and I 
need openmp support. 

I am using libxml2-2.7.7, and gcc

Config flags tried are

./configure

and

./configure --enable-shared --disable-static

and

./configure --without-threads --without-schematron --without-pattern --without-legacy --without-html 
--without-ftp --without-http --without-docbook --without-c14n --without-history --without-regexps 
--without-sax1 --without-schemas --enable-shared

Gcc version is:
gcc (tdm64-1) 4.5.2

Binutils version is 2.21

Windows version: Windows 7 Enterprise.

These all produce the same results.


Thanks in advance




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