[Cython] [PATCH] explain how to compile C++ extensions up to Cython 0.21

Stefan Behnel stefan_ml at behnel.de
Thu Oct 30 19:32:15 CET 2014


Daniele Nicolodi schrieb am 25.10.2014 um 03:36:
> ---
>  docs/src/userguide/wrapping_CPlusPlus.rst | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/docs/src/userguide/wrapping_CPlusPlus.rst b/docs/src/userguide/wrapping_CPlusPlus.rst
> index 59c89a1..5119b63 100644
> --- a/docs/src/userguide/wrapping_CPlusPlus.rst
> +++ b/docs/src/userguide/wrapping_CPlusPlus.rst
> @@ -141,6 +141,21 @@ Note that the ``language`` option has no effect on user provided Extension
>  objects that are passed into ``cythonize()``.  It is only used for modules
>  found by file name (as in the example above).
>  
> +The ``cythonize()`` function in Cython versions up to 0.21 does not
> +recognize the ``language`` option and it needs to be specified as an
> +option to an :class:`Extension` that describes your extension and that
> +is then handled by ``cythonize()`` as follows::
> +
> +   from distutils.core import setup, Extension
> +   from Cython.Build import cythonize
> +
> +   setup(ext_modules = cythonize(Extension(
> +              "rect",                                # the extesion name
> +              sources=["rect.pyx", "Rectangle.cpp"], # the Cython source and
> +                                                     # additional C++ source files
> +              language="c++",                        # generate and compile C++ code
> +         )))
> +
>  The options can also be passed directly from the source file, which is
>  often preferable (and overrides any global option).  Starting with
>  version 0.17, Cython also allows to pass external source files into the

Thanks.

https://github.com/cython/cython/commit/dba0a5f0e80c676367a2a137ac88d33c5ee0119a

Stefan



More information about the cython-devel mailing list