Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
63b3b849
Commit
63b3b849
authored
Jun 17, 2018
by
gabrieldemarmiesse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Put a code snippet from external_c_code.rst into the examples directory for testing.
parent
5c04c1a8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
10 deletions
+11
-10
docs/examples/userguide/external_C_code/c_code_docstring.pyx
docs/examples/userguide/external_C_code/c_code_docstring.pyx
+9
-0
docs/src/userguide/external_C_code.rst
docs/src/userguide/external_C_code.rst
+2
-10
No files found.
docs/examples/userguide/external_C_code/c_code_docstring.pyx
0 → 100644
View file @
63b3b849
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
)
docs/src/userguide/external_C_code.rst
View file @
63b3b849
...
...
@@ -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 ::
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment