Hi Costin,

No need to cross-post to both c-dev and c-user. Just pick one.

Costin Iordache <[EMAIL PROTECTED]> writes:

> I'm using xerces 2.7 on Windows XP SP3, Visual Studio 2003. Everything was
> fine until I needed to declare a static variable (at file scope) which, in
> turn, contained references to xerces objects that need xercesc_2_7
> ::Initialize/ xercesc_2_7::Terminate pair functions to be called first.

I don't think it is possible to reliably call Initialize()/Terminate()
in Xerces-C++ 2 series from static constructor/destructor because, as
you have discovered, the cleanup mechanism also depends on static
objects and the order of initialization of static objects across
translation units is undefined.

For the upcoming Xerces-C++ 3.0.0 we have re-worked the whole
initialization/termination mechanism so that it does not depend
on static objects (and double-checked locking). So I think it
should be possible to initialize/terminate it from static
c-tors/d-tors. You can test it and see if it works by trying
the beta:

http://marc.info/?l=xerces-c-users&m=120541881312475&w=2

Boris

-- 
Boris Kolpackov, Code Synthesis Tools   http://codesynthesis.com/~boris/blog
Open source XML data binding for C++:   http://codesynthesis.com/products/xsd
Mobile/embedded validating XML parsing: http://codesynthesis.com/products/xsde

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to