[xml] =?ISO-8859-1?Q?Re=3A=20=27RE=3A=20=5Bxml=5D=20Initialization=22=27?=



Hi,

on 4/28/2004 2:59 PM Ohad Oded wrote:

Hi, 
If intended to be called only once at finalization time of the library
why isn't it called from DllMain when the reason is DLL_PROCESS_DETACH
and xmlInitParser called when the reason is DLL_PROCESS_ATTACH?

You may want to read an existing mailing list tread on this subject for 
additional information:
http://mail.gnome.org/archives/xml/2003-August/msg00161.html

Regards,

Kasimier

-----Original Message-----
From: Kasimier Buchcik [mailto:kbuchcik 4commerce de] 
Sent: Wednesday, April 28, 2004 3:36 PM
To: Ohad Oded; xml gnome org
Subject: Re: 'RE: [xml] Initialization"'

Hi,

on 4/28/2004 1:47 PM Ohad Oded wrote:


Hi, 
Now I'm experiencing problem in the following sequence (I'm using
WIN32):
Thread A calls xmlInitParser().
.
.
.
Thread A calls xmlCleanupParser().
.
.
.
Thread B calls xmlInitParser()

The code of xmlInitParser() from thread B crashes, I think it has to

do

with the fact that it's not the same thread that initially called
xmlInitParser() (thread A). It crashes in __xmlGenericError within
IS_MAIN_THREAD and the problem is that run_once_init was not set back

to

0 in xmlCleanupParser() (I'm not sure if intentionally or not).


As said before: "xmlCleanupParser" is intended to be called only once at

finalization time of the library, not in-between. Put your call of 
"xmlCleanupParser" outside your thread mechanism, i.e. into the main
thread.


on 4/28/2004 9:44 AM Ohad Oded wrote:



Hi, 



I'm experiencing an access violation.

When working with xmlParseFile() everything is ok.

However when working with xmlReaderForMemory() I have an access
violation because xmlInitParser() wasn't called.

Is this intentional (meaning I have to call it myself)? 


Yes, "xmlInitParser" needs to be called to initialize the library;

this 

function is reentrant, so don't care how often you call it. Some

libxml2

functions call "xmlInitParser", so you were just lucky in the case of 
"xmlParseFile". Note that it initializes the library only, it is not 
designated to be called before parsing (its name is a bit misleading).


Additionally, "xmlCleanupParser" needs to be called to finalize the
library.


Regards,

Kasimier


Kasimier




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