Caveat on C++ usage

There are several more caveats on C++ usage to keep in the back of your mind when using it.

Calling in C and C++ functions

When you write a code to call in a C++ function from C, you need to wrap the prototypes in the following:

extern "C" { … }

This allows you to call C++ prototypes because C won't understand a C++ class. With Cython, if you are telling your C output to call in C++ functions, you need to be careful about which compiler you are using or you need to write a new header to implement the minimal wrapper functions required to make the C++ calls.


Cython seems to generally require a namespace to keep things nested, which you are probably doing in your C++ code already. Making PXD on non-namespaced code seems ...

Get Learning Cython Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.