[C++-sig] back-embedding... is this possible?

blairs at free.fr blairs at free.fr
Mon Jul 10 10:44:49 CEST 2006


ok my project looks like this  :

// my boost-python module

struct A
{
    A(){}
    void toto(){...}
};

BOOST_PYTHON_MODULE(my_module)
{
    class_<A>("A", init<>())
		.def("toto", &A::toto);
}



/// my final C++ program

int main()
{
A a;
//do sum c++ stuff

//start the python interpreter...

PyRun_String("import my_module");
reverse_extract<class_<A>>(a, __mainmodule__,"a"); //this is, symbolically, what
I want to do
PyRun_String("a.toto()");

...
}

is this behaviour possible to create?



More information about the Cplusplus-sig mailing list