Commit 63b3b849 authored by gabrieldemarmiesse's avatar gabrieldemarmiesse

Put a code snippet from external_c_code.rst into the examples directory for testing.

parent 5c04c1a8
cdef extern from *:
"""
/* This is C code which will be put
* in the .c file output by Cython */
static long square(long x) {return x * x;}
#define assign(x, y) ((x) = (y))
"""
long square(long x)
void assign(long& x, long y)
......@@ -332,17 +332,9 @@ Including verbatim C code
-------------------------
For advanced use cases, Cython allows you to directly write C code
as "docstring" of a ``cdef extern from`` block::
as "docstring" of a ``cdef extern from`` block:
cdef extern from *:
"""
/* This is C code which will be put
* in the .c file output by Cython */
static long square(long x) {return x * x;}
#define assign(x, y) ((x) = (y))
"""
long square(long x)
void assign(long& x, long y)
.. literalinclude:: ../../examples/userguide/external_C_code/c_code_docstring.pyx
The above is essentially equivalent to having the C code in a file
``header.h`` and writing ::
......
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