Guido van Rossum | 6dbd190 | 1996-08-21 15:03:37 +0000 | [diff] [blame] | 1 | /* |
| 2 | |
| 3 | Entry point for the Windows NT DLL. |
| 4 | |
| 5 | About the only reason for having this, is so initall() can automatically |
| 6 | be called, removing that burden (and possible source of frustration if |
| 7 | forgotten) from the programmer. |
| 8 | |
| 9 | */ |
Guido van Rossum | 6dbd190 | 1996-08-21 15:03:37 +0000 | [diff] [blame] | 10 | |
Guido van Rossum | a1ebdbd | 1997-05-05 22:18:50 +0000 | [diff] [blame] | 11 | #include "Python.h" |
Kristján Valur Jónsson | 629ec26 | 2007-05-26 19:31:39 +0000 | [diff] [blame] | 12 | #include "windows.h" |
Guido van Rossum | 6dbd190 | 1996-08-21 15:03:37 +0000 | [diff] [blame] | 13 | |
Christian Heimes | 3971f6b | 2007-11-30 19:18:08 +0000 | [diff] [blame] | 14 | #ifdef Py_ENABLE_SHARED |
Guido van Rossum | ec68092 | 1997-09-29 23:37:12 +0000 | [diff] [blame] | 15 | char dllVersionBuffer[16] = ""; // a private buffer |
| 16 | |
| 17 | // Python Globals |
Guido van Rossum | 6dbd190 | 1996-08-21 15:03:37 +0000 | [diff] [blame] | 18 | HMODULE PyWin_DLLhModule = NULL; |
Guido van Rossum | ec68092 | 1997-09-29 23:37:12 +0000 | [diff] [blame] | 19 | const char *PyWin_DLLVersionString = dllVersionBuffer; |
| 20 | |
Guido van Rossum | 6dbd190 | 1996-08-21 15:03:37 +0000 | [diff] [blame] | 21 | |
| 22 | BOOL WINAPI DllMain (HANDLE hInst, |
| 23 | ULONG ul_reason_for_call, |
| 24 | LPVOID lpReserved) |
| 25 | { |
| 26 | switch (ul_reason_for_call) |
| 27 | { |
| 28 | case DLL_PROCESS_ATTACH: |
| 29 | PyWin_DLLhModule = hInst; |
Guido van Rossum | ec68092 | 1997-09-29 23:37:12 +0000 | [diff] [blame] | 30 | // 1000 is a magic number I picked out of the air. Could do with a #define, I spose... |
| 31 | LoadString(hInst, 1000, dllVersionBuffer, sizeof(dllVersionBuffer)); |
Guido van Rossum | a1ebdbd | 1997-05-05 22:18:50 +0000 | [diff] [blame] | 32 | //initall(); |
Guido van Rossum | 6dbd190 | 1996-08-21 15:03:37 +0000 | [diff] [blame] | 33 | break; |
| 34 | case DLL_PROCESS_DETACH: |
| 35 | break; |
| 36 | } |
| 37 | return TRUE; |
| 38 | } |
Christian Heimes | 3971f6b | 2007-11-30 19:18:08 +0000 | [diff] [blame] | 39 | |
| 40 | #endif /* Py_ENABLE_SHARED */ |