HGE and Python (again)

Diez B. Roggisch deets at nospam.web.de
Thu Dec 11 18:11:41 EST 2008


Cro schrieb:
> Good day.
> 
> I've been trying to port HGE (http://hge.relishgames.com) to Python
> for more than 4 months now...
> HGE is a hardware accelerated 2D game engine.
> It comes with the source and examples. In the folder "include", you
> can find "hge.h", the file that i am talking about in all the post.
> 
> #
> I tried to load the DLL functions with Python Ctypes like this :
> [code]
>>>> from ctypes import *
>>>> HGE = cdll.LoadLibrary("C:/hge181/hge")
>>>> HGE.hgeCreate(0x180)
> [/code]
> But i get this error : "Procedure called with not enough arguments (4
> bytes missing) or wrong calling convention".
> The call should be done with hgeCreate(HGE_VERSION) and the constant
> is defined as "#define HGE_VERSION 0x180"...
> Number 0x180 means 384 in Python. I don't mean what it means in C.
> So i am stuck.

You are aware that ctypes knows another call for windows dlls with 
another calling convention?

http://docs.python.org/library/ctypes.html#loading-dynamic-link-libraries

Looking at the headers, I see

#define CALL  __stdcall

So to me it looks as if you use the wrong DLL-loading mechanism.

Diez



More information about the Python-list mailing list