Did you get an answer to this?<br>
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<br><br><div><span class="gmail_quote">On 4/5/06, <b class="gmail_sendername">Dominic Sacré</b> <
<a href="mailto:dominic.sacre@gmx.de">dominic.sacre@gmx.de</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi,<br><br>I'm having trouble exporting C++ pointers to Python. My code looks like
<br>this:<br><br>class A<br>{<br> A *p;<br> ...<br>};<br><br>BOOST_PYTHON_MODULE(test)<br>{<br> class_<A>("A", init<>())<br> .def_readonly("p", &A::p)<br> ...<br>
;<br>}<br><br>Now every time I try to access A::p from Python I get this error:<br><br>TypeError: No to_python (by-value) converter found for C++ type: A*<br><br>I searched the list archives and found a message about the same issue,
<br>where the only suggestion was to use<br><br>.def_readonly("p", make_getter(&A::p, return_internal_reference<1>()))<br><br>instead, but this doesn't help either. On the contrary, this causes a<br>segfault every time I use A::p (although p points to a valid object, at
<br>least in C++).<br>So what should I do to access this pointer from Python?<br><br>Thanks,<br> Dominic<br>_______________________________________________<br>C++-sig mailing list<br><a href="mailto:C++-sig@python.org">
C++-sig@python.org</a><br><a href="http://mail.python.org/mailman/listinfo/c++-sig">http://mail.python.org/mailman/listinfo/c++-sig</a><br></blockquote></div><br>