ctypes windll loading:交互式vs脚本

时间:2014-03-12 20:06:32

标签: windows dll cygwin ctypes

在Cygwin,Windows(64位)上运行WinPython(64位):

从交互式Python提示符(在包含myLib.dll的目录中)我可以这样做:

>>>import ctypes
>>>lib = ctypes.windll.myLib
>>>lib.someFunc() # I can call the functions in myLib as expected

当然,我想从脚本中加载库。我试过了

lib = ctypes.WinDLL('myLib')

lib = ctypes.cdll.LoadLibrary('myLib.dll')

lib = ctypes.WinDll.LoadLibrary('myLib')

一切都无济于事。实际上,错误是

WindowsError: [998] Invalid access to memory location

如何从脚本中加载库?

% myScript.py

lib = ctypes.windll.myLib

不起作用。同样[998]错误。

0 个答案:

没有答案