relationship between C/C++ Extension and cython #4028
-
Hi, Please check the following 2 pieces of code. setup(
name = 'hello'
ext_modules=[
Extension('foo',
glob(path.join(here, 'src', '*.c')),
libraries = [ 'rt' ],
include_dirs=[numpy.get_include()])
]
) setup(
name = 'hello'
ext_modules=cython([
Extension('foo',
glob(path.join(here, 'src', '*.c')),
libraries = [ 'rt' ],
include_dirs=[numpy.get_include()])
])
) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi @ardeal, as far as I am aware there is no It is not clear for me how do those things play out... I would recommend having a look on the Cython docs: https://cython.readthedocs.io/en/latest/ |
Beta Was this translation helpful? Give feedback.
Setuptools natively supports .c files in Extensions. That is a built-in capability.
You don't use
cythonize
with C extensions.You just use cythonize when you have
.pyx
files1, because it converts.pyx
files into.c
(have a look on the Cython docs for more details).Footnotes
kind of... if you use the
Extension
class properly, you might not need to usecythonize
at all because setuptools will try to call itself cythonize on the.pyx
files. I recommend giving it a try and see if that works, if not you can revert to cythonize. ↩