0

Python で DLL 関数を使用する際に問題があります。「dumpbin」の字で関数名を調べてみました。

例えば

_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,"_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

私は何を間違っていますか?

ps私はpythonを知りませんが、私はそれを学びます。ctype-manual を読み、答えを見つけようとしました...

pps私のひどい英語でごめんなさい。

4

1 に答える 1

1

cdllの代わりにwindllを使用してみてください。
xorsLib = windll.LoadLibrary("xors3d.dll") http://docs.python.org/release/3.1.5/library/ctypes.html
理由はmartineauがコメントしたのと同じです。

于 2012-08-10T00:25:28.467 に答える