Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > External code and functions integration

Reply
Thread Tools

External code and functions integration

 
 
Cro
Guest
Posts: n/a
 
      09-22-2008
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.



Recently i discovered PyInline and SciPy Weave. They say that Weave
can run C code on the fly, inline... I really dobt that it can parse
things like:
"
#ifndef HGE_H
#define HGE_H
"
or:
"
#include <windows.h>

#define HGE_VERSION 0x180

#ifdef HGEDLL
#define EXPORT __declspec(dllexport)
#else
#define EXPORT
#endif

#define CALL __stdcall
"

Has anyone ever encountered a problem like this ?
Any, ANY advice or idea would be useful !
Thank you very much.
 
Reply With Quote
 
 
 
 
Diez B. Roggisch
Guest
Posts: n/a
 
      09-22-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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code integration MATLAB and Ruby Djoudjou Ruby 9 09-03-2009 11:21 PM
please help me in distinguish redefining functions, overloading functions and overriding functions. Xiangliang Meng C++ 1 06-21-2004 03:11 AM
External inline functions calling internal inline functions Daniel Vallstrom C Programming 2 11-21-2003 01:57 PM



Advertisments