1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
/*
* --------------------------------------------------------------------------
* Copyright (C) 1997 Netscape Communications Corporation
* --------------------------------------------------------------------------
*
* dllmain.c
*
* $Id: dllmain.c,v 1.1.1.1 2003/11/20 22:13:10 toshok Exp $
*/
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
static int ProcessesAttached = 0;
static HINSTANCE Instance; /* Global library instance handle. */
/*
* The following declaration is for the VC++ DLL entry point.
*/
BOOL APIENTRY DllMain (HINSTANCE hInst,
DWORD reason, LPVOID reserved);
/*
*----------------------------------------------------------------------
*
* DllEntryPoint --
*
* This wrapper function is used by Borland to invoke the
* initialization code for Tcl. It simply calls the DllMain
* routine.
*
* Results:
* See DllMain.
*
* Side effects:
* See DllMain.
*
*----------------------------------------------------------------------
*/
BOOL APIENTRY
DllEntryPoint(hInst, reason, reserved)
HINSTANCE hInst; /* Library instance handle. */
DWORD reason; /* Reason this function is being called. */
LPVOID reserved; /* Not used. */
{
return DllMain(hInst, reason, reserved);
}
/*
*----------------------------------------------------------------------
*
* DllMain --
*
* This routine is called by the VC++ C run time library init
* code, or the DllEntryPoint routine. It is responsible for
* initializing various dynamically loaded libraries.
*
* Results:
* TRUE on sucess, FALSE on failure.
*
* Side effects:
* Establishes 32-to-16 bit thunk and initializes sockets library.
*
*----------------------------------------------------------------------
*/
BOOL APIENTRY
DllMain(hInst, reason, reserved)
HINSTANCE hInst; /* Library instance handle. */
DWORD reason; /* Reason this function is being called. */
LPVOID reserved; /* Not used. */
{
switch (reason) {
case DLL_PROCESS_ATTACH:
/*
* Registration of UT need to be done only once for first
* attaching process. At that time set the tclWin32s flag
* to indicate if the DLL is executing under Win32s or not.
*/
if (ProcessesAttached++) {
return FALSE; /* Not the first initialization. */
}
Instance = hInst;
return TRUE;
case DLL_PROCESS_DETACH:
ProcessesAttached--;
break;
}
return TRUE;
}
|