[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: [xml] xmlFree() segmentation fault with dinamic library
- From: Daniel Veillard <veillard redhat com>
- To: SOM3ONE <hippydream gmx net>
- Cc: xml gnome org
- Subject: Re: [xml] xmlFree() segmentation fault with dinamic library
- Date: Wed, 11 May 2005 14:18:40 -0400
On Wed, May 11, 2005 at 06:59:31PM +0200, SOM3ONE wrote:
> here is the code examle i was using to test the problem:
Step 1/ clean up the shared lib crap and fall back to clean C
paphio:~/XML -> cat tst.c
#include <stdio.h>
#include "libxml/xmlmemory.h"
#include "libxml/parser.h"
int
main(int argc, char **argv)
{
xmlDocPtr doc;
xmlNodePtr cur;
xmlChar *attr;
doc = xmlParseFile("test.xml");
if (doc == 0) {
printf("xmlParseFile error\n");
return 1;
}
cur = xmlDocGetRootElement(doc);
if (cur == 0) {
printf("xmlDocGetRootElement error\n");
xmlFreeDoc(doc);
return 1;
}
if (xmlStrcmp(cur->name, (const xmlChar *) "OSDaB_XML")) {
printf("invalid root\n");
xmlFreeDoc(doc);
return 1;
}
attr = xmlGetProp(cur, (const xmlChar *) "version");
if (attr != 0) {
printf("version: %s\n", attr);
xmlFree(attr);
}
return 0;
}
paphio:~/XML ->
Step 2/ compile in a clean way against the installed shared librairies
paphio:~/XML -> gcc -Wall -o tst `xml2-config --cflags` tst.c `xml2-config --libs`
paphio:~/XML ->
Step 3/ check the shared libraries
paphio:~/XML -> ldd tst
libxml2.so.2 => /usr/lib/libxml2.so.2 (0x007b7000)
libz.so.1 => /usr/lib/libz.so.1 (0x009bc000)
libm.so.6 => /lib/tls/libm.so.6 (0x0018b000)
libc.so.6 => /lib/tls/libc.so.6 (0x00b03000)
libdl.so.2 => /lib/libdl.so.2 (0x0044f000)
/lib/ld-linux.so.2 (0x00717000)
paphio:~/XML ->
Step 4/ verify it works
paphio:~/XML -> ./tst
version: 1.0
paphio:~/XML ->
> I really can't realize where the problem could be!
> the xml test file is parsed correctly by other xml parsers (like the one
> used by Trolltech's Qt toolkit).
libxml2 parses it correctly too of course, no problem. Now something
is screwed in the way you use the C++ or the dynamic shared library loading
but this has positively nothing to do with libxml2 as I just demonstrated.
Daniel
--
Daniel Veillard | Red Hat Desktop team http://redhat.com/
veillard redhat com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]