Commit ab740487 authored by Robert Bradshaw's avatar Robert Bradshaw

Merge pull request #139 from echlebek/patch-1

Update docs/src/userguide/external_C_code.rst
parents b49d9c67 da97e28d
...@@ -314,12 +314,26 @@ the public keyword:: ...@@ -314,12 +314,26 @@ the public keyword::
cdef public int spam # public variable declaration cdef public int spam # public variable declaration
cdef public void grail(Bunny *): # public function declaration cdef public void grail(Bunny *): # public function declaration
... print "Ready the holy hand grenade"
If there are any public declarations in a Cython module, a header file called If there are any public declarations in a Cython module, a header file called
:file:`modulename.h` file is generated containing equivalent C declarations for :file:`modulename.h` file is generated containing equivalent C declarations for
inclusion in other C code. inclusion in other C code.
Users who are embedding Python in C with Cython need to make sure to call Py_Initialize()
and Py_Finalize(). For example, in the following snippet that includes :file:`modulename.h`::
#include <Python.h>
#include "modulename.h"
void grail() {
Py_Initialize();
initmodulename();
Bunny b;
grail(b);
Py_Finalize();
}
Any C code wanting to make use of these declarations will need to be linked, Any C code wanting to make use of these declarations will need to be linked,
either statically or dynamically, with the extension module. either statically or dynamically, with the extension module.
......
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