home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tk42r2s.zip / tk4.2 / os2 / tkOS2Dll.c < prev    next >
C/C++ Source or Header  |  1998-01-25  |  1KB  |  64 lines

  1. /* 
  2.  * tkOS2Dll.c --
  3.  *
  4.  *    This file contains a stub dll entry point.
  5.  *
  6.  * Copyright (c) 1996-1998 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 _DLL_InitTerm(unsigned long modHandle, unsigned long flag)
  40. {
  41.     /*
  42.      * If we are attaching to the DLL from a new process, tell Tk about
  43.      * the hInstance to use. If we are detaching then clean up any
  44.      * data structures related to this DLL.
  45.      */
  46.  
  47.     switch (flag) {
  48.     case 0:     /* INIT */
  49.         /* Save handle */
  50.         dllHandle = modHandle;
  51.         TkOS2InitPM();
  52.         TkOS2XInit(TkOS2GetAppInstance());
  53.         return TRUE;
  54.  
  55.     case 1:     /* TERM */
  56.         TkOS2ExitPM();
  57.         /* Invalidate handle */
  58.         dllHandle = (unsigned long)NULLHANDLE;
  59.         return TRUE;
  60.     }
  61.  
  62.     return FALSE;
  63. }
  64.