home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / lstbx3.zip / xlistini.cpp < prev   
Text File  |  1994-05-17  |  1KB  |  44 lines

  1. /*******************************************************************************
  2. * FILE NAME: xlistini.cpp                                                      *
  3. *                                                                              *
  4. * DESCRIPTION:                                                                 *
  5. *   This file contains DLL initialization termination routine.                 *
  6. *                                                                              *
  7. *******************************************************************************/
  8. #include <stdio.h>
  9.  
  10. // function prototypes
  11. extern "C"
  12. {
  13.   int  _CRT_init      (void );
  14.   void __ctordtorInit (void );
  15. }
  16.  
  17. unsigned long _System _DLL_InitTerm (unsigned long hmodule,
  18.                                      unsigned long ulFlag )
  19. {
  20.   unsigned long ulRC = 1;         // assume no errors
  21.  
  22.   if (ulFlag == 0)
  23.   {                               // DLL being loaded
  24.      if (_CRT_init() == -1)
  25.        ulRC = 0;                  // error
  26.      else
  27.        __ctordtorInit();
  28.   }
  29.   else
  30.   {
  31.     if (ulFlag == 1)
  32.     {                             // DLL being freed
  33.       //Since we are only linking dynamically, we do not need to
  34.       //perform termination processing.  If we were linking statically,
  35.       //we would need to call __ctordtorTerm() and _CRT_term() here in
  36.       //that order.
  37.     }
  38.     else
  39.       ulRC = 0;                   // error
  40.   }
  41.  
  42.   return( ulRC );
  43. }
  44.