函数名无效的Python和Cdll

2024-03-28 10:29:40 发布

您现在位置:Python中文网/ 问答频道 /正文

在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手册,试图找到答案。。。你知道吗

对不起,我的英语糟透了。你知道吗


Tags: 函数frommodectypeswidthintdll调用函数