在python中使用DLL函数有问题。 我借助“dumpbin”查找函数名。你知道吗
例如
你知道吗_XS3d@20你知道吗
我试着这样调用函数:
from ctypes import *
xorsLib = cdll.LoadLibrary("Xors3D.dll")
width = c_int(800)
height = c_int(600)
depth = c_int(32)
mode = c_int(0)
vsync = c_int(0)
xGraphics3D = getattr(xorsLib,"_xGraphics3D@20")
xGraphics3D(width, height, depth, mode, vsync)
但这是错误的原因:
Traceback (most recent call last):
File "D:/Coding/Python/pyASG/main", line 11, in <module>
xGraphics3D(width, height, depth, mode, vsync)
ValueError: Procedure called with not enough arguments (20 bytes missing) or wrong calling convention
我做错什么了?你知道吗
另外,我不懂python,但我学会了。我读了ctype手册,试图找到答案。。。你知道吗
对不起,我的英语糟透了。你知道吗
尝试使用windll而不是cdll。
xorsLib = windll.LoadLibrary("xors3d.dll")
http://docs.python.org/release/3.1.5/library/ctypes.html原因和马蒂诺评论的一样。你知道吗
相关问题 更多 >
编程相关推荐