[Resend as it seemed to have gotten lost]

>>> On 1/8/2013 at  5:29 PM, Eduard Budaca <budaca.edu...@gmail.com> wrote:
> I am using Code::Blocks with the GNU GCC compiler on Windows XP.
> I am currently learning to use libxml2 so I am trying the tutorials.
> Everything worked fine until trying xmlFree(), whick resulted in an
> undefined reference.
> After searching in the headers I found the #define IN_LIBXML fix, which
> resulted in a segfault.
> After trying a commit which required editing the xmlexports.h file, I got a
> segault again.
> 
> So, since this bug has (apparently) been around for a while, I would like
> to know if there is a fix for it or a replacement for xmlFree()

Some questions:
- Where did you get the binaries for libxml
- What version of libxml
- Which import library are you linking to (shared/static)

If its a later version of libxml with shared import library (ie. linking to the 
DLL via the .dll.a import library - if built via ./configure && make; I do not 
use), it "should" just work, if its the static version (normally .a) , then you 
should define LIBXML_STATIC (-DLIBXML_STATIC to CFLAGS/CXXFLAGS). If its the 
latter case (static) and you did not define LIBXML_STATIC, then its *not a bug*.

If you built it yourself and used win32/Makefile.mingw, then you probably will 
run into issues, as it generates:

  libxml2.lib
  libxml2.a

which will cause problems (and probably *is a bug*), as the default search 
order for LD with MinGW is:

  libxml2.dll.a
  xml2.dll.a
  libxml2.a
  xml2.lib
  libxml2.dll
  xml2.dll
  xml2.lib

and will cause "libxml2.a" to be found first even with the shared import 
library present ("libxml2.lib" - rather a MSVC naming scheme than a GCC/LD 
one), and as you probably did *not* have LIBXML_STATIC defined, you are back to 
the undefined reference. In this case I guess you can just remove "libxml2.a" 
if you want to link to the DLL and not static, else add the define...

Also, I guess not using import libraries generated with gcc/binutils (ie. .LIB 
via MSVC) could cause other problems.


Regards,
Martin



Vrywaringsklousule / Disclaimer:  
http://www.nwu.ac.za/it/gov-man/disclaimer.html 

_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml@gnome.org
https://mail.gnome.org/mailman/listinfo/xml

Reply via email to