Embedding as scripting engine

Marcelo A. Camelo camelo at esss.com.br
Tue Jul 8 14:48:30 EDT 2003


If you're using c++, take a look at boost::python, a fantastic 
tool that can save you a lot of work when it comes to write the 
bindings.

I would seriously consider extending instead of embedding. 
I've done both and extending is, IMO, the way to go.

http://twistedmatrix.com/users/glyph/rant/extendit.html has some 
good points on the subject. I second to all arguments presented 
there.

--camelo

-----Original Message-----
From: python-list-admin at python.org [mailto:python-list-admin at python.org]
On Behalf Of Úlfur Kristjánsson
Sent: terça-feira, 8 de julho de 2003 07:51
To: python-list at python.org
Subject: Embedding as scripting engine


Python... a great language, no doubt. And the abillity to be able to
extend it with C/C++ code, fantastic. But has anybody been able to
successfully embed Python in their application to use it as a scripting
language of sorts?

I am in the process of writing a game and from the documentation and
word of mouth gathered that Python would be just the thing for the
scripting part. And sure enough it is easy enough to run Python code
from C/C++. However, in order to be make it do something actually useful
for my game it would be handy to be able to pass in anything besides the
basic data types (strings, numerics) such as either an instance of or a
pointer to a gameobject. What I want to be able to do is something like
this:

GameObject go;

Py_Initialize()
...
PyObject* po = GameObject2PyObject(go);
...
result = PyObject_CallObject(func, "O", po );
...
go = PyObject2GameObject(result);

Theres alot of documentation and discussion out there that suggests that
this should be possible but noone seems to tell you how it's actually
done. Am I just missing something blatantly obvious?

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






More information about the Python-list mailing list