Though, you should be careful about this as well. At some point in the
future, Xerces might dynamically load another library, which is verboten
within DllMain processing, right? An obvious example might be a transcoding
library or socket library or some such thing. I don't think it does now on
the Win32 platform, but it could change.

--------------
Dean Roddey
Software Geek Extraordinaire
Portal, Inc
[EMAIL PROTECTED]



-----Original Message-----
From: Maxim Volkonovsky [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 08, 2001 1:22 AM
To: Mitchell, Raymond
Cc: '[EMAIL PROTECTED]'
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:[EMAIL PROTECTED]
 Maxim



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

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

Reply via email to