[pywin32-checkins] pywin32/Pythonwin Win32uiHostGlue.h,1.8,1.9
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: <mha...@us...> - 2003-07-08 01:25:32
|
Update of /cvsroot/pywin32/pywin32/Pythonwin In directory sc8-pr-cvs1:/tmp/cvs-serv9327 Modified Files: Win32uiHostGlue.h Log Message: Try harder to find our .dll./pyd Index: Win32uiHostGlue.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/Win32uiHostGlue.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Win32uiHostGlue.h 7 Jul 2003 14:09:40 -0000 1.8 --- Win32uiHostGlue.h 8 Jul 2003 01:25:29 -0000 1.9 *************** *** 119,146 **** // (A brutal search trying a LoadLibrary on *all* Pythons we find is very // unlikely to come up with the right one. HMODULE hModCore = NULL; int i; HMODULE hModWin32ui = LoadLibrary(szWinui_Name); if (hModWin32ui==NULL) { ! // don't give up now - try a local Python. for (i=15;i<40;i++) { ! char fname[MAX_PATH*2]; ! strcpy(fname, "\0"); ! GetModuleFileName(NULL, fname, sizeof(fname)); ! char *p = fname + strlen(fname); ! while (p>fname && *p != '\\') ! p--; ! if (p>fname) { ! char pyname[20]; ! #ifdef _DEBUG ! wsprintf(pyname, "Python%d_d.dll", i); ! #else ! wsprintf(pyname, "Python%d.dll", i); ! #endif ! strcpy(p+1, pyname); ! hModCore = LoadLibrary(fname); ! if (hModCore) ! break; ! } } if (!hModCore) { --- 119,151 ---- // (A brutal search trying a LoadLibrary on *all* Pythons we find is very // unlikely to come up with the right one. + char app_dir[MAX_PATH]; + strcpy(app_dir, "\0"); + GetModuleFileName(NULL, app_dir, sizeof(app_dir)); + char *p = app_dir + strlen(app_dir); + while (p>app_dir && *p != '\\') + p--; + *p = '\0'; + + char fname[MAX_PATH*2]; + HMODULE hModCore = NULL; int i; HMODULE hModWin32ui = LoadLibrary(szWinui_Name); if (hModWin32ui==NULL) { ! // try an installed version ! wsprintf(fname, "%s\\%s\\%s", app_dir, "lib\\site-packages\\pythonwin", szWinui_Name); ! hModWin32ui = LoadLibrary(fname); ! } ! if (hModWin32ui==NULL) { ! // Still no need to give up - try a local Python. for (i=15;i<40;i++) { ! #ifdef _DEBUG ! wsprintf(fname, "%s\\Python%d_d.dll", app_dir, i); ! #else ! wsprintf(fname, "%s\\Python%d.dll", app_dir, i); ! #endif ! hModCore = LoadLibrary(fname); ! if (hModCore) ! break; } if (!hModCore) { *************** *** 188,191 **** --- 193,201 ---- if (pfnPyInit && bShouldInitPython) { (*pfnPyInit)(); + void (__cdecl *pfnPyEval_InitThreads)(void); + pfnPyEval_InitThreads = (void (__cdecl *)(void))GetProcAddress(hModCore, "PyEval_InitThreads"); + ASSERT(pfnPyEval_InitThreads); + if (pfnPyEval_InitThreads) + pfnPyEval_InitThreads(); } |