Re: [xml] xmlDocDump() on Windows



Daniel Corbe wrote:
/* Begin code snippet */
xmlDocPtr mtp3;
FILE *xml;

mtp3 = xmlReadFile(config->MTP3filename, NULL, 0); xml =
fopen(config->MTP3filename, FOPEN_MODE_OVERWRITE); if (!xml ||
ferror(xml)) {

outputf("ERROR WRITING MTP3 XML File: %s\n", strerror(errno)); } else
{ xmlDocDump(xml, mtp3); fclose(xml); }
(...)
I've tried building my app on both debug and release, and the same thing happens.
You're saying there may be something wrong with my build environment?
(...)
      libxml2-2.6.30 (binary) as gotten from:
      http://www.zlatkovic.com/libxml.en.html


This cannot work.
You cannot reliably work with FILE* as a parameter to any dll unless you are 100% sure that it uses _exactly_ 
the same runtime version.

Now, the prebuilt version of libxml2 links against MSVCRT.dll (as it is built using VC6, afaik)

You however, using VC8, are linking your program against an exact version of MSVCR80?.dll which you can find 
in the WINDOWS/WinSxS directory.

If you want to use any libxml2 function that relies on runtime lib structures like FILE* you have to compile 
it yourself against the same msvcr* version as your application.

Personally, I would avoid these functions and use something like xmlDocDumpFormatMemory to write the tree to 
memory and save that to a file.

Br,
Martin


best regards / mit freundlichen Grüßen,
Martin Trappel
-------------------------------------------------------------------------
Kristl, Seibt & Co Ges.m.b.H. / A-8052 Graz
Tel.: (+43 316) 5995 - 1581
mailto:martin trappel ksengineers at



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