You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Mitchell, Raymond" <Ra...@intuit.com> on 2001/05/08 19:29:31 UTC

RE: Re[2]: Problem initializing and terminating XMLPlatformUtils more th an o nce in a program

Thanks.

-----Original Message-----
From: Maxim Volkonovsky [mailto:maxwolf@cma.ru]
Sent: Tuesday, May 08, 2001 1:22 AM
To: Mitchell, Raymond
Cc: 'xerces-c-dev@xml.apache.org'
Subject: Re[2]: Problem initializing and terminating XMLPlatformUtils
more th an o nce in a program


Hello Raymond,

Tuesday, May 08, 2001, you wrote:

MR> Thanks.  I realize now that this is covered in the FAQ.  I actually do
have
MR> a need to initialize and terminate the utilities multiple times in a
single
MR> process.  I have several different libraries that use Xerces-C, each
needing
[...]

As for Win32 platform the right way is to implement DllMain function
somewhere in the Win32PlatformUtils.cpp to handle xerces dll loading
and unloading events:

BOOL WINAPI DllMain(
  HINSTANCE hinstDLL,  // handle to the DLL module
  DWORD fdwReason,     // reason for calling function
  LPVOID lpvReserved)  { // reserved

    switch(fdwReason) {
    case DLL_PROCESS_ATTACH:
        XMLPlatformUtils::Initialize();
        break;
    case DLL_PROCESS_DETACH:
        XMLPlatformUtils::Terminate();
        break;
  }
  return TRUE;
}

Having that you may use xerces in your modules without initialization,
or call Init/Term with no risc of deinitialization in the middle of
the way. I think that the same approach clould be used for other
platforms.

Best regards,                           mailto:maxwolf@cma.ru
 Maxim



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org