Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-06-02 00:05:26

From: "David GD Wilson" <firestar_at_[hidden]>

> Dave,
> Thanks for the response. I have looked into the method you have
> suggested below. However unsure how I can create a CTest instance within
> my c++ code? I can see how it will work if I create the CTest/PTest from
> inside python, but I need to create the CTest/PTest from c++.
> Is this going to be possible with the method you have suggested?

Sure. Just use

    class_builder<CTest,CTest> c_test;
    // Get the class object
    PyTypeObject* PTest = c_test.get_extension_class();

    // call the Python class to make a new instance.
    python::ref x = python::callback<python::ref>::call((PyObject*)PTest,
a1, a2...)

where a1, a2... are the constructor arguments.

Now x manages a Python PTest object which holds a CTest instance.


Boost list run by bdawes at, gregod at, cpdaniel at, john at