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" |
Guido van Rossum | e7ba495 | 2007-06-06 23:52:48 +0000 | [diff] [blame] | 12 | #include "windows.h" |
Guido van Rossum | 6dbd190 | 1996-08-21 15:03:37 +0000 | [diff] [blame] | 13 | |
Guido van Rossum | ec68092 | 1997-09-29 23:37:12 +0000 | [diff] [blame] | 14 | char dllVersionBuffer[16] = ""; // a private buffer |
| 15 | |
| 16 | // Python Globals |
Guido van Rossum | 6dbd190 | 1996-08-21 15:03:37 +0000 | [diff] [blame] | 17 | HMODULE PyWin_DLLhModule = NULL; |
Guido van Rossum | ec68092 | 1997-09-29 23:37:12 +0000 | [diff] [blame] | 18 | const char *PyWin_DLLVersionString = dllVersionBuffer; |
| 19 | |
Guido van Rossum | 6dbd190 | 1996-08-21 15:03:37 +0000 | [diff] [blame] | 20 | |
| 21 | BOOL WINAPI DllMain (HANDLE hInst, |
| 22 | ULONG ul_reason_for_call, |
| 23 | LPVOID lpReserved) |
| 24 | { |
| 25 | switch (ul_reason_for_call) |
| 26 | { |
| 27 | case DLL_PROCESS_ATTACH: |
| 28 | PyWin_DLLhModule = hInst; |
Guido van Rossum | ec68092 | 1997-09-29 23:37:12 +0000 | [diff] [blame] | 29 | // 1000 is a magic number I picked out of the air. Could do with a #define, I spose... |
| 30 | LoadString(hInst, 1000, dllVersionBuffer, sizeof(dllVersionBuffer)); |
Guido van Rossum | a1ebdbd | 1997-05-05 22:18:50 +0000 | [diff] [blame] | 31 | //initall(); |
Guido van Rossum | 6dbd190 | 1996-08-21 15:03:37 +0000 | [diff] [blame] | 32 | break; |
| 33 | case DLL_PROCESS_DETACH: |
| 34 | break; |
| 35 | } |
| 36 | return TRUE; |
| 37 | } |