Debian Codegraph @

pTk/mTk/win/tkWin32Dll.c

raw
1 /*
2 * tkWin32Dll.c --
3 *
4 * This file contains a stub dll entry point.
5 *
6 * Copyright (c) 1995 Sun Microsystems, Inc.
7 *
8 * See the file "license.terms" for information on usage and redistribution
9 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
10 *
11 * RCS: @(#) $Id: tkWin32Dll.c,v 1.6 2002/12/08 00:46:51 hobbs Exp $
12 */
13
14 #include "tkWinInt.h"
15
16 static HINSTANCE tclInstance; /* Global library instance handle. */
17
18 /*
19 * The following declaration is for the VC++ DLL entry point.
20 */
21
22 BOOL APIENTRY DllMain _ANSI_ARGS_((HINSTANCE hInst,
23 DWORD reason, LPVOID reserved));
24
25 /*
26 *----------------------------------------------------------------------
27 *
28 * DllEntryPoint --
29 *
30 * This wrapper function is used by Borland to invoke the
31 * initialization code for Tk. It simply calls the DllMain
32 * routine.
33 *
34 * Results:
35 * See DllMain.
36 *
37 * Side effects:
38 * See DllMain.
39 *
40 *----------------------------------------------------------------------
41 */
42
43 BOOL APIENTRY
44 DllEntryPoint(hInst, reason, reserved)
45 HINSTANCE hInst; /* Library instance handle. */
46 DWORD reason; /* Reason this function is being called. */
47 LPVOID reserved; /* Not used. */
48 {
49 return DllMain(hInst, reason, reserved);
50 }
51
52 /*
53 *----------------------------------------------------------------------
54 *
55 * DllMain --
56 *
57 * DLL entry point. It is only necessary to specify our dll here so
58 * that resources are found correctly. Otherwise Tk will initialize
59 * and clean up after itself through other methods, in order to be
60 * consistent whether the build is static or dynamic.
61 *
62 * Results:
63 * Always TRUE.
64 *
65 * Side effects:
66 * None.
67 *
68 *----------------------------------------------------------------------
69 */
70
71 BOOL APIENTRY
72 DllMain(hInstance, reason, reserved)
73 HINSTANCE hInstance;
74 DWORD reason;
75 LPVOID reserved;
76 {
77 /*
78 * If we are attaching to the DLL from a new process, tell Tk about
79 * the hInstance to use.
80 */
81
82 if (reason == DLL_PROCESS_ATTACH) {
83 tclInstance = hInstance;
84 TkWinSetHINSTANCE(hInstance);
85 } else if (reason == DLL_PROCESS_DETACH) {
86 TkWinXCleanup(hInstance);
87 }
88 return (TRUE);
89 }
90
91 /*
92 * TkWin32DllPresent() can be referenced elsewhere to
93 * force inclusion of this file and hence DLLMain()
94 */
95
96 int
97 TkWin32DllPresent()
98 {
99 return 1;
100 }
101
102 HINSTANCE
103 TclWinGetTclInstance()
104 {
105 return tclInstance;
106 }