Now we are into the&nbsp;dizzying&nbsp;world of template error messages :)<div><br class="webkit-block-placeholder"></div><div>So I have a class Matrix, which exposes a pointer to float, and a conversion operator to POINTER(c_float):</div>
<div><br class="webkit-block-placeholder"></div><div>struct Matrix {</div><div>int test();</div><div>float *ptr();</div><div>};</div><div><br class="webkit-block-placeholder"></div><div><div>struct ctypes_float_ptr</div><div>
{</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>static PyObject *convert(float *ptr)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>{</div><div>&nbsp;&nbsp;<span class="Apple-tab-span" style="white-space:pre">        </span>object ctypes = import(&quot;ctypes&quot;);</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span></div><div><span class="Apple-tab-span" style="white-space:pre">        </span> &nbsp;long_ addr((unsigned)ptr);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> &nbsp;object pointerType(ctypes[&quot;POINTER&quot;](ctypes[&quot;c_float&quot;]));</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span></div><div><span class="Apple-tab-span" style="white-space:pre">        </span> &nbsp;return ctypes[&quot;cast&quot;](addr, pointerType).ptr();</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div>
<div>};</div><div><br class="webkit-block-placeholder"></div><div><div>BOOST_PYTHON_MODULE(math)</div><div>{</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>to_python_converter&lt;float *, ctypes_float_ptr&gt;();</div>
<div><br class="webkit-block-placeholder"></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>class_&lt;Matrix&gt;(&quot;Matrix&quot;)</div><div><div><span class="Apple-tab-span" style="white-space: pre; ">                </span>.def(&quot;test&quot;, &amp;Matrix::test) // this compiles fine</div>
</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>.def(&quot;ptr&quot;, &amp;Matrix::ptr) // error here</div><div><span class="Apple-style-span" style="white-space: pre; ">        </span></div><div>}</div>
</div><div><br class="webkit-block-placeholder"></div><div>And the error is as follows:</div><div><br class="webkit-block-placeholder"></div><div>src/math.cpp:146: error: no matching function for call to 'boost::python::class_&lt;math::Matrix, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified&gt;::def(const char [4], &lt;unknown type&gt;)'</div>
<div><br class="webkit-block-placeholder"></div><div>Any pointers on where to go from here?</div><div><br class="webkit-block-placeholder"></div><div><span class="gmail_quote">On 26/02/2008, <b class="gmail_sendername">Joseph Lisee</b> &lt;<a href="mailto:jlisee@gmail.com">jlisee@gmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex">
&gt; Thank you for the prompt answer - that accomplishes exactly what I was trying<br> to do!<br> &gt; I haven&#39;t had a lot of luck tracking down the hooks to add a manual conversion<br> for &#39;float *&#39; into the types registry, do you have any reference for that handy?<br>
 &gt;<br> &gt; - Tristam<br> <br> <br>No problem, I think this is what you are looking for:<br> <a href="http://www.boost.org/libs/python/doc/v2/to_python_converter.html">http://www.boost.org/libs/python/doc/v2/to_python_converter.html</a><br>
 <br><br> -Joseph Lisee<br> <br><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>&nbsp;</div>