Commit 120fe47b authored by Stefan Behnel's avatar Stefan Behnel

update C-library wrapping tutorial to use cythonize()

parent fb863d29
...@@ -226,12 +226,11 @@ Here is the most basic script for compiling a Cython module:: ...@@ -226,12 +226,11 @@ Here is the most basic script for compiling a Cython module::
from distutils.core import setup from distutils.core import setup
from distutils.extension import Extension from distutils.extension import Extension
from Cython.Distutils import build_ext from Cython.Build import cythonize
setup( setup(
cmdclass = {'build_ext': build_ext}, ext_modules = cythonize([Extension("queue", ["queue.pyx"])])
ext_modules = [Extension("queue", ["queue.pyx"])] )
)
To build against the external C library, we must extend this script to To build against the external C library, we must extend this script to
include the necessary setup. Assuming the library is installed in the include the necessary setup. Assuming the library is installed in the
...@@ -240,16 +239,16 @@ Unix-like system), we could simply change the extension setup from ...@@ -240,16 +239,16 @@ Unix-like system), we could simply change the extension setup from
:: ::
ext_modules = [Extension("queue", ["queue.pyx"])] ext_modules = cythonize([Extension("queue", ["queue.pyx"])])
to to
:: ::
ext_modules = [ ext_modules = cythonize([
Extension("queue", ["queue.pyx"], Extension("queue", ["queue.pyx"],
libraries=["calg"]) libraries=["calg"])
] ])
If it is not installed in a 'normal' location, users can provide the If it is not installed in a 'normal' location, users can provide the
required parameters externally by passing appropriate C compiler required parameters externally by passing appropriate C compiler
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment