Ignore:
Timestamp:
Dec 17, 2000, 12:33:37 AM (25 years ago)
Author:
bird
Message:

Watcom preparations.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/dllentry/dllentry.cpp

    r3993 r4818  
    1 /* $Id: dllentry.cpp,v 1.2 2000-08-11 10:56:14 sandervl Exp $ */
     1/* $Id: dllentry.cpp,v 1.3 2000-12-16 23:31:07 bird Exp $ */
    22
    33/*
     
    3737#include <misc.h>       /*PLF Wed  98-03-18 23:18:15*/
    3838
     39
    3940extern "C" {
     41#ifdef __IBMCPP__
    4042void CDECL _ctordtorInit( void );
    4143void CDECL _ctordtorTerm( void );
    42 
     44#endif
    4345 //Win32 resource table (produced by wrc)
    4446 extern DWORD _Resource_PEResTab;
     
    5355   switch (fdwReason)
    5456   {
    55    case DLL_PROCESS_ATTACH:
    56         return TRUE;
     57      case DLL_PROCESS_ATTACH:
     58         return TRUE;
    5759
    58    case DLL_THREAD_ATTACH:
    59    case DLL_THREAD_DETACH:
    60         return TRUE;
     60      case DLL_THREAD_ATTACH:
     61      case DLL_THREAD_DETACH:
     62         return TRUE;
    6163
    62    case DLL_PROCESS_DETACH:
    63         _ctordtorTerm();
    64         return TRUE;
     64      case DLL_PROCESS_DETACH:
     65#ifdef __IBMCPP__
     66         _ctordtorTerm();
     67#endif
     68         return TRUE;
    6569   }
    6670   return FALSE;
    6771}
     72
     73
     74#ifdef __IBMCPP__
     75
    6876/****************************************************************************/
    6977/* _DLL_InitTerm is the function that gets called by the operating system   */
     
    7482/* calling this function.                                                   */
    7583/****************************************************************************/
    76 unsigned long SYSTEM _DLL_InitTerm(unsigned long hModule, unsigned long
    77                                    ulFlag)
     84unsigned long SYSTEM _DLL_InitTerm(unsigned long hModule, unsigned long ulFlag)
    7885{
    79    size_t i;
    80    APIRET rc;
    81 
    8286   /*-------------------------------------------------------------------------*/
    8387   /* If ulFlag is zero then the DLL is being loaded so initialization should */
     
    8690   /*-------------------------------------------------------------------------*/
    8791
    88    switch (ulFlag) {
     92   switch (ulFlag)
     93   {
    8994      case 0:
    9095         _ctordtorInit();
     96         CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
     97         dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab);
     98         if (dllHandle == 0)
     99            return 0UL;
     100         break;
    91101
    92          CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
     102      case 1:
     103         if (dllHandle)
     104            UnregisterLxDll(dllHandle);
     105         break;
    93106
    94          dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab);
    95          if(dllHandle == 0)
    96                 return 0UL;
    97 
    98          break;
    99       case 1:
    100          if(dllHandle) {
    101                 UnregisterLxDll(dllHandle);
    102          }
    103          break;
    104107      default:
    105108         return 0UL;
     
    111114   return 1UL;
    112115}
    113 //******************************************************************************
    114 //******************************************************************************
     116#elif defined(__WATCOM_CPLUSPLUS__)
     117/*
     118 * Watcom dll init and term routines.
     119 */
     120
     121int __dll_initialize(unsigned long hModule, unsigned long ulFlag)
     122{
     123    CheckVersionFromHMOD(PE2LX_VERSION, hModule);
     124    dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab);
     125    if (dllHandle == 0)
     126        return 0;
     127    return 1;
     128}
     129
     130int __dll_terminate(unsigned long hModule, unsigned long ulFlag)
     131{
     132    if (dllHandle)
     133        UnregisterLxDll(dllHandle);
     134    return 1;
     135}
     136
     137#else
     138#error message("compiler is not supported!\n");
     139#endif
Note: See TracChangeset for help on using the changeset viewer.