External code and functions integration

Diez B. Roggisch deets at nospam.web.de
Mon Sep 22 03:24:15 EDT 2008


Cro schrieb:
> Good day.
> 
> I am using python for quite some time now and i decided to advance a
> little. I want to write a little extension, or add some C modules for
> my python. I use Active version.
> 
> What i want to do is write some wrappers for a game library, called
> HGE. See "hge.relishgames.com".
> I wrote some applications with HGE, in C++ and i like it pretty much.
> In order to make a HGE application in C++, i need to include "hge.h",
> include "hge.lib" and "hgelehper.lib", and have "hge.dll" in the same
> directory. So it's 3 things i must have for the program to work.
> This game library is open source, so i have the source for the libs
> and the dll.
> 
> Now, what i was thinking was to make some wrapping code like "hge.h"
> to call all the functions in the "libs", that (i guess) call the
> functions from "hge.dll", that (blah blah) calls DirectX and so on.
> I guess that if i write all that "hge.h" includes and wariables in
> python, will be okay... even if i still don't have the skill.
> 
> I tried to call "hge.lib" like this:
> "
> from ctypes import *
> cdll.LoadLibrary("D:/HGE18/lib/bc/hge.lib")
> "
> But i get "WindowsError: [Error 193] %1 is not a valid Win32
> application".
> I tried with windll.LoadLibrary ... and i get the same error.
> I tried with the other lib versions, there are 3 versions: BorlandC,
> GCC, VisualC, callind "cdll" or "windll". All lib versions report the
> same error.

Because you need to load the DLL.

Diez



More information about the Python-list mailing list