New submission from yinkaisheng: I created a c++ dll project that calls COM. cyptes works well with the dll on Windows XP(SP3) and Windows 7. But it can't load the dll on windows 8. The function ctypes.cdll.LoadLibrary doesn't return when I call it to load the dll on Windows 8.
The version of my Python is 2.7.6 The version of my Windows 8 is 6.2.9200.16384 I uploaded a sample dll project created by VS2012 as the attachment. Here are the c++ codes // dllmain.cpp : #include "stdafx.h" #include <Windows.h> #include <UIAutomation.h> IUIAutomation *g_pAutomation = NULL; #define DLL_EXPORT __declspec(dllexport) BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: { if (NULL == g_pAutomation) { CoInitialize(NULL); HRESULT hr = CoCreateInstance(__uuidof(CUIAutomation), NULL, CLSCTX_INPROC_SERVER, __uuidof(IUIAutomation), (void**)&g_pAutomation); } break; } case DLL_THREAD_ATTACH: { break; } case DLL_THREAD_DETACH: { break; } case DLL_PROCESS_DETACH: { if (g_pAutomation) { g_pAutomation->Release(); CoUninitialize(); } break; } } return TRUE; } #ifdef __cplusplus extern "C" { #endif DLL_EXPORT int AddTwoNumber(int a, int b) { return a + b; } #ifdef __cplusplus } #endif ---------- components: ctypes files: TestDll.rar messages: 204454 nosy: yinkaisheng priority: normal severity: normal status: open title: ctypes can't load a c++ dll if the dll calls COM on Windows 8 type: behavior versions: Python 2.7 Added file: http://bugs.python.org/file32849/TestDll.rar _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue19790> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com