我正在尝试从自定义.dll文件中调用函数。但是当我尝试加载我的库SDK.dll时,我会收到以下错误。我正在遵循此处找到的指示: Python import dll
有人知道问题出在哪里吗?我只发现这个问题适用于MAC环境的参考资料。
>>> from ctypes import *
>>> lib = ctypes.WinDLL('C:/Develop/test/SDK.dll')
Traceback (most recent call last):
File "<pyshell#19>", line 1, in <module>
lib = ctypes.WinDLL('C:/Develop/test/SDK.dll')
NameError: name 'ctypes' is not defined
Traceback (most recent call last): File "<pyshell#21>", line 1, in <module> lib = ctypes.WinDLL('C:/Develop/test/SDKApplication/Debug/SDKCore.dll') File "C:\Python27\lib\ctypes\__init__.py", line 365, in __init__ self._handle = _dlopen(self._name, mode) WindowsError: [Error 193] %1 不是有效的 Win32 应用程序
,但我认为这可能是因为我的 Python 是 32 位的,而 dll 是 64 位的原因。 - toni