Changeset 4818 for trunk/src


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

Watcom preparations.

Location:
trunk/src
Files:
4 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
  • trunk/src/dllentry/makefile

    r4717 r4818  
    1 # $Id: makefile,v 1.7 2000-12-02 23:39:06 bird Exp $
     1# $Id: makefile,v 1.8 2000-12-16 23:31:08 bird Exp $
    22
    33#
     
    3030#
    3131# Target name - name of the obj without extention and path.
    32 #  NB. Watcom will need it's own target...
    3332#
    34 !ifndef WAT
    3533TARGET = dllentry
    36 !else
    37 TARGET = dllentry_watcom
    38 !endif
    3934
    4035
     
    4237# All rule - build objs and copies obj to lib.
    4338#
    44 all: $(OBJDIR) $(ODIN32_LIB)\$(TARGET).obj
     39all:     $(OBJDIR) \
     40         $(ODIN32_LIB) \
     41         $(ODIN32_LIB)\$(TARGET).obj
    4542
    4643
     
    5653
    5754
     55# Create lib directory.
     56$(ODIN32_LIB):
     57    $(CREATEPATH) $(ODIN32_LIB)
     58
     59
    5860#
    5961# Includes the common rules.
  • trunk/src/odincrt/initterm.cpp

    r2649 r4818  
    1 /* $Id: initterm.cpp,v 1.3 2000-02-05 02:05:37 sandervl Exp $ */
     1/* $Id: initterm.cpp,v 1.4 2000-12-16 23:33:37 bird Exp $ */
    22
    33/*
     
    3535#include <exitlist.h>
    3636
     37#ifdef __IBMCPP__
    3738extern "C" {
    3839/*-------------------------------------------------------------------*/
     
    7172                                   ulFlag)
    7273{
    73    size_t i;
    7474   APIRET rc;
    7575
     
    134134   return ;
    135135}
     136
     137#elif defined(__WATCOM_CPLUSPLUS__)
     138
     139/*
     140 * Watcom dll init and term routines.
     141 */
     142
     143int __dll_initialize(unsigned long hModule, unsigned long ulFlag)
     144{
     145    APIRET rc;
     146    #if 1 /*
     147          * Experimental console hack. Sets apptype to PM anyhow.
     148          * First Dll to be initiated should now allways be OdinCrt!
     149          * So include odincrt first!
     150          */
     151    PPIB pPIB;
     152    PTIB pTIB;
     153    rc = DosGetInfoBlocks(&pTIB, &pPIB);
     154    if (rc != NO_ERROR)
     155        return 0UL;
     156    pPIB->pib_ultype = 3;
     157    #endif
     158    return 1;
     159}
     160
     161int __dll_terminate(unsigned long hModule, unsigned long ulFlag)
     162{
     163    return 1;
     164}
     165
     166#else
     167#error message("compiler is not supported");
     168#endif
     169
  • trunk/src/odincrt/makefile

    r4717 r4818  
    1 # $Id: makefile,v 1.20 2000-12-02 23:40:36 bird Exp $
     1# $Id: makefile,v 1.21 2000-12-16 23:33:37 bird Exp $
    22
    33#
     
    3939DEFFILE = odin36$(DBG).def
    4040!endif
     41!ifdef WAT
     42DEFFILE = odinwat$(DBG).def
     43!endif
    4144!ifndef DEFFILE
    4245!error "not supported on this compiler yet."
     
    5053$(OBJDIR)\odincrt.obj \
    5154$(OBJDIR)\initterm.obj \
     55!ifndef WAT
    5256$(OBJDIR)\malloc.obj \
    5357$(OBJDIR)\string.obj \
    5458$(OBJDIR)\file.obj
     59!else
     60$(%WATCOM)\lib386\os2\$(RTLLIB_O)
     61!endif
    5562
    5663
     
    5865# Libraries. One space before the '\'.
    5966#
    60 LIBS =
     67LIBS = \
     68!ifdef WAT
     69$(RTLLIB_O)
     70!endif
    6171
    6272
Note: See TracChangeset for help on using the changeset viewer.