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&nbsp; the same class<br><br><div><span class="gmail_quote">On 4/5/06, <b class="gmail_sendername">Dominic Sacré</b> &lt;
<a href="mailto:dominic.sacre@gmx.de">dominic.sacre@gmx.de</a>&gt; 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>&nbsp;&nbsp;&nbsp;&nbsp;A *p;<br>&nbsp;&nbsp;&nbsp;&nbsp;...<br>};<br><br>BOOST_PYTHON_MODULE(test)<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;class_&lt;A&gt;(&quot;A&quot;, init&lt;&gt;())<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.def_readonly(&quot;p&quot;, &amp;A::p)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;;<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(&quot;p&quot;, make_getter(&amp;A::p, return_internal_reference&lt;1&gt;()))<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>&nbsp;&nbsp;&nbsp;&nbsp;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>