[xsd-users] (Windows) mixing debug/release Xerces lib

Boris Kolpackov boris at codesynthesis.com
Tue Feb 24 12:46:32 EST 2009


Hi Greg,

Greg Carter <greg at permedia.ca> writes:

> They all use dll runtimes. Since the problem went away after switching 
> the xerces lib I figured it must have been in how XSD used it, as the 
> only call I make directly to xerces is the initialization call 
> (XMLPlatformUtils::Initialize).  However it sounds like XSD is doing all 
> the right things.  Must be something else that is causing the problem.  
> It occurs somewhere in DOMImplementation* impl 
> (DOMImplementationRegistry::getDOMImplementation (ls_id));

In my experience, access violation in getDOMImplementation()
almost invariably means that XMLPlatformUtils::Initialize()
hasn't been called. Perhaps here is what happens: when both
plugins use the same Xerces-C++ DLL, dynamic linker only
loads it once and the second plugin simply reuses the same
Xerces-C++ DLL. When one plugin uses the release and the
other uses the debug versions of Xerces-C++, since the DLL
are different, the linker probably loads both of them. My
guess would be that the second DLL does not get a call to
its Initialize() (you may actually be calling Initialize()
twice but both calls may be routed to the same DLL).

I am no expert in dynamic linking on Windows so I don't know
how loading of two DLLs with the same symbols should be handled
by the application. Perhaps you can try to obtain the pointer
to Initialize() dynamically using the DLL handle and call it
via this pointer.

Boris




More information about the xsd-users mailing list