[issue19790] ctypes can't load a c++ dll if the dll calls COM on Windows 8

yinkaisheng report at bugs.python.org
Sat Nov 30 06:46:58 CET 2013


yinkaisheng added the comment:

http://support.microsoft.com/kb/305723

COM application hangs when you call CoCreateInstance from DllMain

SYMPTOMS
When you call the CoCreateInstance function from the DllMain function, the Component Object Model (COM) application hangs.

CAUSE
CoCreateInstance may start a thread that tries to call the DllMain function of all dynamic-link libraries (DLLs) that exist in the process by passing a DLL_THREAD_ATTACH value. Because the call originates from DllMain, and because DllMain is not a reentrant function, the call to CoCreateInstance never returns.

RESOLUTION
To resolve this problem, do not call CoCreateInstance from DllMain. You can move the call to an initialization function or to any other function that is called later.

STATUS
This behavior is by design.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19790>
_______________________________________


More information about the Python-bugs-list mailing list