home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tkisrc04.zip / tk / os2 / tkOS2DLL.c < prev    next >
C/C++ Source or Header  |  1998-09-09  |  2KB  |  78 lines

  1. /* 
  2.  * tkOS2Dll.c --
  3.  *
  4.  *    This file contains a stub dll entry point.
  5.  *
  6.  * Copyright (c) 1996-1997 Illya Vaes
  7.  * Copyright (c) 1995 Sun Microsystems, Inc.
  8.  *
  9.  * See the file "license.terms" for information on usage and redistribution
  10.  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  11.  */
  12.  
  13. #include "tkPort.h"
  14. #include "tkOS2Int.h"
  15.  
  16. int _CRT_init(void);
  17. void _CRT_term(void);
  18.  
  19. /* Save the Tk DLL handle for TkPerl */
  20. unsigned long dllHandle = (unsigned long) NULLHANDLE;
  21.  
  22.  
  23. /*
  24.  *----------------------------------------------------------------------
  25.  *
  26.  * _DLL_InitTerm --
  27.  *
  28.  *    DLL entry point.
  29.  *
  30.  * Results:
  31.  *    TRUE on sucess, FALSE on failure.
  32.  *
  33.  * Side effects:
  34.  *    None.
  35.  *
  36.  *----------------------------------------------------------------------
  37.  */
  38.  
  39. unsigned long /*MM* add { */
  40. #ifdef __IBMC__
  41. _System
  42. #endif
  43. /*MM* } */ _DLL_InitTerm(unsigned long modHandle, unsigned long flag)
  44. {
  45.     /*
  46.      * If we are attaching to the DLL from a new process, tell Tk about
  47.      * the hInstance to use. If we are detaching then clean up any
  48.      * data structures related to this DLL.
  49.      */
  50.  
  51.     switch (flag) {
  52.     case 0:     /* INIT */
  53.         /* Save handle */
  54.         dllHandle = modHandle;
  55.         TkOS2InitPM();
  56.         TkOS2XInit(TkOS2GetAppInstance());
  57. /*MM* add { */
  58. #if defined(__IBMC__) && !defined(DYNAMICLIBS)
  59.     _CRT_init();
  60. #endif
  61. /*MM* } */
  62.         return TRUE;
  63.  
  64.     case 1:     /* TERM */
  65.         TkOS2ExitPM();
  66.         /* Invalidate handle */
  67.         dllHandle = (unsigned long)NULLHANDLE;
  68. /*MM* add { */
  69. #if defined(__IBMC__) && !defined(DYNAMICLIBS)
  70.     _CRT_term();
  71. #endif
  72. /*MM* } */
  73.         return TRUE;
  74.     }
  75.  
  76.     return FALSE;
  77. }
  78.