source: trunk/third/evolution-data-server/libdb/build_win32/dllmain.c @ 21189

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