C++ pointers in Cython
<p>I use Cython to wrap my C++ classes. Some of methods return sth. like <code>class_name*</code>. <code>class_name</code> may be some complicated class already described in pxd and pyx file (like it is mentioned here in extended answer <a href="http://stackoverflow.com/a/39116733/4881441">http://stackoverflow.com/a/39116733/4881441</a>). But Cython says in pyx defs that I am returning not a Python type. I want to be able to return c++-like pointers in python and then use methods of this objects and to pass them to c++ methods.</p>

<p>You can't directly return a pointer from a <code>def</code> method (only from a <code>cdef</code>).</p>

<p>You'll need to write a Cython Wrapper class that stores the pointer you want to pass and you can return this Wrapper Object.
If you want to execute methods on the C++ object you also have to use your Cython Wrapper and delegate the method calls to the stored instance.</p>

python c++ c++11 pointers cython