[C++-sig] How to create an arbitary Python Object from C/C++
david.abrahams at rcn.com
Wed May 1 18:51:28 CEST 2002
----- Original Message -----
From: "Terry Barnaby" <terry at beam.demon.co.uk>
> I am trying to create a Python wrapper for a C++ class.
> Most of this is working, but I am stumped on how to create an arbitary
> of a Python user defined class.
> I can create a Python object from a C++ class definition with
> how do I create a Python object of class "PyRect" whoose definition
> is in Python ?
> I cannot find this in any of the C/C++ interface documentation.
The usual method is to get the class object out of the module and "call"
it with the appropriate arguments for its __init__ function. If you're
using Boost.Python v1, you'll want to use
boost::python::callback<PyObject*>::call(the_class, arg1, arg2...);
More information about the Cplusplus-sig