[C++-sig] Wrapping pointers

Dominic Sacré dominic.sacre at gmx.de
Fri Apr 14 02:18:53 CEST 2006


On Thursday, 13. April 2006 22:16, Tony Kirke wrote:
> Did you get an answer to this?
> I am trying to figure out the same thing except my pointer is to an
> object of a different class instead of  the same class

Nope, no reply. So I'm still looking for hints how to do this.


> On 4/5/06, Dominic Sacré <dominic.sacre at gmx.de> wrote:
> > Hi,
> >
> > I'm having trouble exporting C++ pointers to Python. My code looks
> > like this:
> >
> > class A
> > {
> >     A *p;
> >     ...
> > };
> >
> > BOOST_PYTHON_MODULE(test)
> > {
> >     class_<A>("A", init<>())
> >         .def_readonly("p", &A::p)
> >         ...
> >     ;
> > }
> >
> > Now every time I try to access A::p from Python I get this error:
> >
> > TypeError: No to_python (by-value) converter found for C++ type: A*



More information about the Cplusplus-sig mailing list