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
Gwenaël Samain
cython
Commits
a8420f18
Commit
a8420f18
authored
Aug 11, 2018
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor doc clarifications and fixes.
parent
2e816fbd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
docs/src/userguide/source_files_and_compilation.rst
docs/src/userguide/source_files_and_compilation.rst
+9
-8
No files found.
docs/src/userguide/source_files_and_compilation.rst
View file @
a8420f18
...
@@ -29,10 +29,10 @@ Compiling from the command line
...
@@ -29,10 +29,10 @@ Compiling from the command line
There are two ways of compiling from the command line.
There are two ways of compiling from the command line.
* The ``cython`` command takes a ``.py`` or ``.pyx`` file and
* The ``cython`` command takes a ``.py`` or ``.pyx`` file and
compile it into a C/C++ file.
compile
s
it into a C/C++ file.
* The ``cythonize`` command takes a ``.py`` or ``.pyx`` file and
* The ``cythonize`` command takes a ``.py`` or ``.pyx`` file and
compile
it into a C/C++ file.
It then compiles the C/C++ file into
compile
s it into a C/C++ file.
It then compiles the C/C++ file into
an extension module which is directly importable from Python.
an extension module which is directly importable from Python.
...
@@ -75,8 +75,7 @@ running multiple parallel build jobs. When called without further options, it
...
@@ -75,8 +75,7 @@ running multiple parallel build jobs. When called without further options, it
will only translate the source files to ``.c`` or ``.cpp`` files. Pass the
will only translate the source files to ``.c`` or ``.cpp`` files. Pass the
``-h`` flag for a complete list of supported options.
``-h`` flag for a complete list of supported options.
There is also a simpler command line tool named ``cython`` which only invokes
There simpler command line tool ``cython`` only invokes the source code translator.
the source code translator.
In the case of manual compilation, how to compile your ``.c`` files will vary
In the case of manual compilation, how to compile your ``.c`` files will vary
depending on your operating system and compiler. The Python documentation for
depending on your operating system and compiler. The Python documentation for
...
@@ -420,10 +419,10 @@ macro to it::
...
@@ -420,10 +419,10 @@ macro to it::
If you are only targeting Python 3.x, just use ``PyInit_`` as prefix.
If you are only targeting Python 3.x, just use ``PyInit_`` as prefix.
Then, for each o
r
the modules, declare its module init function
Then, for each o
f
the modules, declare its module init function
as follows, replacing ``
...`` by
the name of the module::
as follows, replacing ``
some_module_name`` with
the name of the module::
PyMODINIT_FUNC MODINIT(
...
) (void);
PyMODINIT_FUNC MODINIT(
some_module_name
) (void);
In C++, declare them as ``extern C``.
In C++, declare them as ``extern C``.
...
@@ -436,7 +435,7 @@ with ``Py_Initialize()``, you need to initialise the modules at runtime
...
@@ -436,7 +435,7 @@ with ``Py_Initialize()``, you need to initialise the modules at runtime
using the ``PyImport_AppendInittab()`` C-API function, again inserting
using the ``PyImport_AppendInittab()`` C-API function, again inserting
the name of each of the modules::
the name of each of the modules::
PyImport_AppendInittab("
...", MODINIT(...
));
PyImport_AppendInittab("
some_module_name", MODINIT(some_module_name
));
This enables normal imports for the embedded extension modules.
This enables normal imports for the embedded extension modules.
...
@@ -447,6 +446,8 @@ C-compiling the module C files.
...
@@ -447,6 +446,8 @@ C-compiling the module C files.
Also take a look at the `cython_freeze
Also take a look at the `cython_freeze
<https://github.com/cython/cython/blob/master/bin/cython_freeze>`_ tool.
<https://github.com/cython/cython/blob/master/bin/cython_freeze>`_ tool.
It can generate the necessary boilerplate code for linking one or more
modules into a single Python executable.
.. _pyximport:
.. _pyximport:
...
...
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