2012-08-10 24 views
0

我在使用python中的DLL函数时遇到了问题。 我看了“dumpbin”的功能名称。函数名无效的Python和C-dll

例如

_xGraphics3D @ 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,"[email protected]") 
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 

我在做什么错误?

p.s.我还不知道python,但我知道它。我读了ctype手册,并试图找到答案...

p.p.s对不起,我可怕的英语。

+1

撇开我的头,你有没有机会使用C++编译器?如果是这样,你可能需要声明你的函数'extern“C”'来防止C++的正常名称改变。参见例如[this](http://www.cplusplus.com/forum/windows/54482/)文章。 – martineau 2012-08-10 00:17:16

+0

它不是我的图书馆,我无法访问源代码。 – 2012-08-10 00:48:04

回答