Re: [xml] xmlDocDump crashing on windows



Enno Rehling wrote:
I have a very simple program:

  xmlDocPtr doc = xmlParseFile("small.xml");
  xmlDocDump(stdout, doc);

The xmlDocDump crashes on windows, not on linux. At first I thought it might be the precompiled win32 binaries, so I downloaded the libxml source (libxml2-2.6.2), compiled it myself, but get the same error.

This shouldn't crash, should it? It does when I'm setting code genreation to be anything but the "Multithreaded DLL" (so not non-DLL, and especially not Debug). xmlDocDump is the first function that's shown that behaviour.

Here's the stack, in case that helps anyone:

ntdll.dll!77f69ecd() msvcr71.dll!free(void * pBlock=0x004750e6) Line 103 + 0x5 C > libxml2.dll!xmlBufferAdd(_xmlBuffer * buf=0x00000000, const unsigned char * str=0x00000002, int len=1244532) Line 6746 + 0x1a C 0012fedc() ntdll.dll!77f5b2e6() msvcr71.dll!_lock_file(void * pf=0x004493d0) Line 236 C msvcr71.dll!fwrite(const void * buffer=0x004760c0, unsigned int size=64, unsigned int count=1, _iobuf * stream=0x004493d0) Line 72 + 0x8 C libxml2.dll!xmlFileWrite(void * context=0x004493d0, const char * buffer=0x004760c0, int len=64) Line 765 + 0x14 C libxml2.dll!xmlOutputBufferFlush(_xmlOutputBuffer * out=0x00475008) Line 2887 + 0x1f C libxml2.dll!xmlOutputBufferClose(_xmlOutputBuffer * out=0x00475008) Line 2075 + 0x9 C libxml2.dll!xmlDocFormatDump(_iobuf * f=0x004493d0, _xmlDoc * cur=0x00478660, int format=0) Line 8429 + 0x9 C libxml2.dll!xmlDocDump(_iobuf * f=0x004493d0, _xmlDoc * cur=0x00478660) Line 8444 + 0xf C xml-schemas.exe!main(int argc=1, char * * argv=0x004814c0) Line 38 + 0xe C++
     xml-schemas.exe!mainCRTStartup()  Line 259 + 0x19    C
kernel32.dll!77e814c7()

The xml file is dead simple, too:
<?xml version="1.0" encoding="utf-8"?>
<small>
<test/>
</small>

Enno.

Well I don't know what the problem is... we have never before discussed this topic...

Your runtime, msvcr71.dll, is probably delivered with the visual studio .net. My development machine, xp professional sp1, does not have this library. Whatever you compiled there will not run on any machine which doesn't have visual studio installed.

You must ensure that all programs in the line use the same runtime. So you must compile iconv, zlib, libxml2 and your program, all of them using the same runtime.

Ciao,
Igor




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