/* Entry point for the Windows NT DLL. About the only reason for having this, is so initall() can automatically be called, removing that burden (and possible source of frustration if forgotten) from the programmer. */ #include "windows.h" /* NT and Python share these */ #include "pyconfig.h" #include "Python.h" // Python Globals HMODULE PyWin_DLLhModule = NULL; // If we are building the library for static linking we will not // be able to use the DllMain function to initialize the Version String and // this will cause the functions relying on finding the version specific // configuration on the Windows Registry to fail // This define will initialize the version variable and eliminate the DllMain // function from the static library #ifdef Py_NO_ENABLE_SHARED #include "python_nt.h" const char *PyWin_DLLVersionString = MS_DLL_ID; #else char dllVersionBuffer[16] = ""; // a private buffer const char *PyWin_DLLVersionString = dllVersionBuffer; BOOL WINAPI DllMain (HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: PyWin_DLLhModule = hInst; // 1000 is a magic number I picked out of the air. Could do with a #define, I spose... LoadString(hInst, 1000, dllVersionBuffer, sizeof(dllVersionBuffer)); //initall(); break; case DLL_PROCESS_DETACH: break; } return TRUE; } #endif