embedding python

Robert Dailey rcdailey at gmail.com
Thu Feb 7 22:04:06 CET 2008


Hi,

I'm attempting to embed python into my game. What I want to do is the
following:

1) Embed the interpreter into my game (Py_Initialize(), etc) using the
Python C API
2) Execute modules from my game using the python interpreter (Using
boost.python's objects and handles)
3) Expose C++ interfaces in my game that can be called from modules executed
through the interpreter integrated in my application.

Number 3, above, is the one I am not sure how to do. I know how to use
Boost.Python to create a DLL exposing functions that can be called from any
Python module, but I want to expose C++ functions into python for ONLY
modules processed by my game. I want game-related function calls (Like
CompleteQuest()) to be available to the Python scripts run through my game.
This is sort of how LUA works: You define a set of functions in your
application that are callable through scripts run BY the game only.

Can anyone help me on #3 above? How would I do this? Can you reference me to
documentation either in the boost library or python?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080207/cf2e97a0/attachment.html>


More information about the Python-list mailing list