[xml] Threads and statically linked libxml2 in a plugin



Hello,

I use the libxml2 in my multi-threaded app (let's say MYAPP).
MYAPP runs on Linux-ppc and links libxml2 statically (libxml2.a).
MYAPP is able to load plugins, and one of these plugins uses libxml2 too. This plugin also links statically libxml2.

My question: Should I call xmlInitParser() and xmlCleanupParser() in the plugin code?

The doc says that xmlInitParser() should be called once per process, so the answer should be "no". But as the code of libxml2 is duplicated in the plugin (because of static link), will all the libxml2 variables initialized?

Note that if I do the init/cleanup calls in the plugin, the thread dumps core on pthred_exit. The crash is in xmlFreeGlobalState(). I guess because of the pthread_key_create(&globalkey, xmlFreeGlobalState) done in xmlOnceInit(void).
It does not crash on Windows (no use of Posix threads).

Thanks for you help,
Greg

PS: I can't use libxml2 as a shared lib.



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