Shlyapin Eugene
Shlyapin Eugene

Reputation: 23

Python and C-dll with invalid name of function

I have a problem with using DLL function in python. I looked the name of function by dint of "dumpbin".

For example

_xGraphics3D@20

I tried to call the function like this:

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)

but it's cause the error:

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

what am i doing wrong?

p.s. i haven't know python, but i learn it. i read ctype-manual and tried to find answer...

p.p.s sorry for my awful english.

Upvotes: 0

Views: 102

Answers (1)

silvesthu
silvesthu

Reputation: 399

Try use windll instead of cdll.
xorsLib = windll.LoadLibrary("xors3d.dll") http://docs.python.org/release/3.1.5/library/ctypes.html
The reason is the same as martineau commented.

Upvotes: 1

Related Questions