| 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 | * SCCS: @(#) tkWin32Dll.c 1.9 96/08/06 15:59:08 |
| 12 | */ |
| 13 | |
| 14 | #include "pTk/tkPort.h" |
| 15 | |
| 16 | #ifdef WIN32 |
| 17 | |
| 18 | #include "pTk/tkWinInt.h" |
| 19 | |
| 20 | static HINSTANCE tclInstance; /* Global library instance handle. */ |
| 21 | |
| 22 | /* |
| 23 | * The following declaration is for the VC++ DLL entry point. |
| 24 | */ |
| 25 | |
| 26 | BOOL APIENTRY DllMain _ANSI_ARGS_((HINSTANCE hInst, |
| 27 | DWORD reason, LPVOID reserved)); |
| 28 | |
| 29 | /* |
| 30 | *---------------------------------------------------------------------- |
| 31 | * |
| 32 | * DllEntryPoint -- |
| 33 | * |
| 34 | * This wrapper function is used by Borland to invoke the |
| 35 | * initialization code for Tk. It simply calls the DllMain |
| 36 | * routine. |
| 37 | * |
| 38 | * Results: |
| 39 | * See DllMain. |
| 40 | * |
| 41 | * Side effects: |
| 42 | * See DllMain. |
| 43 | * |
| 44 | *---------------------------------------------------------------------- |
| 45 | */ |
| 46 | |
| 47 | BOOL APIENTRY |
| 48 | DllEntryPoint(hInst, reason, reserved) |
| 49 | HINSTANCE hInst; /* Library instance handle. */ |
| 50 | DWORD reason; /* Reason this function is being called. */ |
| 51 | LPVOID reserved; /* Not used. */ |
| 52 | { |
| 53 | return DllMain(hInst, reason, reserved); |
| 54 | } |
| 55 | |
| 56 | /* |
| 57 | *---------------------------------------------------------------------- |
| 58 | * |
| 59 | * DllMain -- |
| 60 | * |
| 61 | * DLL entry point. |
| 62 | * |
| 63 | * Results: |
| 64 | * TRUE on sucess, FALSE on failure. |
| 65 | * |
| 66 | * Side effects: |
| 67 | * None. |
| 68 | * |
| 69 | *---------------------------------------------------------------------- |
| 70 | */ |
| 71 | |
| 72 | BOOL APIENTRY |
| 73 | DllMain(hInstance, reason, reserved) |
| 74 | HINSTANCE hInstance; |
| 75 | DWORD reason; |
| 76 | LPVOID reserved; |
| 77 | { |
| 78 | /* |
| 79 | * If we are attaching to the DLL from a new process, tell Tk about |
| 80 | * the hInstance to use. If we are detaching then clean up any |
| 81 | * data structures related to this DLL. |
| 82 | */ |
| 83 | |
| 84 | if (reason == DLL_PROCESS_ATTACH) { |
| 85 | tclInstance = hInstance; |
| 86 | // TkWinXInit(hInstance); |
| 87 | } else if (reason == DLL_PROCESS_DETACH) { |
| 88 | // TkWinXCleanup(hInstance); |
| 89 | } |
| 90 | return(TRUE); |
| 91 | } |
| 92 | |
| 93 | /* |
| 94 | * TkWin32DllPresent() can be referenced elsewhere to |
| 95 | * force inclusion of this file and hence DLLMain() |
| 96 | */ |
| 97 | |
| 98 | int |
| 99 | TkWin32DllPresent() |
| 100 | { |
| 101 | return 1; |
| 102 | } |
| 103 | |
| 104 | HINSTANCE |
| 105 | TclWinGetTclInstance() |
| 106 | { |
| 107 | return tclInstance; |
| 108 | } |
| 109 | |
| 110 | #endif /* WIN32 */ |
| 111 |