我试图.dll在Python中使用C++ ,但我甚至无法加载它.我正在尝试以下python代码来加载它:
from ctypes import cdll
mydll = cdll.LoadLibrary('SORT_DLL.dll')
Run Code Online (Sandbox Code Playgroud)
但当我尝试运行时,我得到:
D:\...\src\SORT_DLL\Debug>UseDll.py
Traceback (most recent call last):
File "D:\...\src\SORT_DLL\Debug\UseDll.py", line 2, in
<module>
mydll = cdll.LoadLibrary('SORT_DLL.dll')
File "C:\Python27\lib\ctypes\__init__.py", line 443, in LoadLibrary
return self._dlltype(name)
File "C:\Python27\lib\ctypes\__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
WindowsError: [Error 193] %1 ist keine zulõssige Win32-Anwendung
Run Code Online (Sandbox Code Playgroud)
最后一句用英语表示"%1不是有效的Win32应用程序".
我已经在http://docs.python.org/2/library/ctypes.html#module-ctypes上查了一下,但这并没有为我的问题找到解决方案.