
on Thu Feb 07 2008, "Robert Dailey"
Hi,
I have a game that currently integrates the python interpreter using the Python C API. I would like to expose various C++ interfaces & functions to python, but I want to do so without having to create a separate DLL, as state needs to be modified in the actual core engine of the game as the user calls C++ functions from Python.
That really doesn't have much bearing on whether your extension module is in a DLL or not. You can always link your DLL extension module directly to your application as well as letting Python load it.
For example, say I have a C++ function called CompleteQuest(). In Python, we would script a quest for my game and at some point call CompleteQuest() from python. This should map directly to a function in the executable (game).
Is there a way to do this? Thanks.
Yes, it's called "embedding Python;" see http://www.boost.org/libs/python/doc/building.html HTH, -- Dave Abrahams Boost Consulting http://boost-consulting.com