I've been learning about Cython recently. I'm still a beginner, but I'm excited about the prospect of using it in the future.
In my mind, Cython has two main uses:
Making Cython or C/C++ functions accessible from Python. See: Calling C functions.
- You can expose Cython and C/C++ functions to Python by making a Cython module extension using setuptools.
Making Cython or Python functions accessible from C/C++. See: Embedding Cython modules in C/C++ applications.
- You can expose Cython and Python functions to C/C++ by embedding the Python interpreter into your C/C++ application using
Py_Initialize
and company.
- You can expose Cython and Python functions to C/C++ by embedding the Python interpreter into your C/C++ application using
What if you want to do both of these things for the same project?
Is there a way to use Cython to create a shared object (.so) file which can both be imported as a Python module, and linked against from C/C++?