Re: Calling C/C++ not contained inside a .dll

2005-05-16 Thread Mike Meyer
[EMAIL PROTECTED] writes:

 My question is..
 How do I get python scripts to call functions in my game code without
 having to build a .dll that has the entire meat of my game inside of
 it?  Ultimately I want to be able to load scripts from my game and
 have those scripts call functions in my game code.

This is a pretty generic question for any application: how do I invoke
my applications functionality from a python script.

You want to embed python in your game, and then extend the embedded
python interpter. This is covered in the chapter with pretty much that
as the title: url:
http://docs.python.org/ext/extending-with-embedding.html .

 mike
-- 
Mike Meyer [EMAIL PROTECTED]  http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list


Calling C/C++ not contained inside a .dll

2005-05-15 Thread delrocco
Hello,

I really appreciate anyone who has time to read this and help, Thanks
up front.
I'm very new to python, having picked it up for the first time a week
ago, but I feel I'm very close to getting this working.

Here's what I'm trying to do:
 - call python scripts from game code
 - have those called scripts call functions that are back in game code

The first part looks easy enough to do if I use, ppembed or something.
The second part has been driving me nuts, because I thought I had a
solution and now I just feel defeated.

I've gotten SWIG working and built a .dll extension with functions in
it to be loaded from python and communicate with my game.  I've
successfully imported it into a python interpreter and called
functions in it.

The problem is I haven't figured out how to make those calls call
functions in my game application.  If I load the same .dll from my
game and pass in a structure full of function pointers, the
communication from the game to the .dll works... but then the module I
am using in the python interpreter is not the same one, as if its a
copy.

My question is..
How do I get python scripts to call functions in my game code without
having to build a .dll that has the entire meat of my game inside of
it?  Ultimately I want to be able to load scripts from my game and
have those scripts call functions in my game code.

Example:
- game calls script's onDamage function
- script sets various variables, and then calls swapModel function in
game

Thanks,
Joe

-- 
http://mail.python.org/mailman/listinfo/python-list