diff options
author | Armin Rigo <arigo@tunes.org> | 2017-03-11 14:03:31 +0100 |
---|---|---|
committer | Armin Rigo <arigo@tunes.org> | 2017-03-11 14:03:31 +0100 |
commit | 5886754bf619526890e94c8ca8354eaf4042ebda (patch) | |
tree | 750ec3fbb66e28e4ce6d29c65904c049f389185d | |
parent | 9058e58fa0db1a81e498f7b7a40bf0d0ede822d8 (diff) | |
download | cffi-5886754bf619526890e94c8ca8354eaf4042ebda.tar.gz |
move the 'use cases' before the 'how-to' section
-rw-r--r-- | doc/source/embedding.rst | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/doc/source/embedding.rst b/doc/source/embedding.rst index ab7d8bb..f43be93 100644 --- a/doc/source/embedding.rst +++ b/doc/source/embedding.rst @@ -9,6 +9,21 @@ to any C application that wants to link with this C code. This API, which you define yourself, ends up as the API of a ``.so/.dll/.dylib`` library---or you can statically link it within a larger application. +Possible use cases: + +* Exposing a library written in Python directly to C/C++ programs. + +* Using Python to make a "plug-in" for an existing program that is + already written to load them. + +* Using Python to implement part of a larger C/C++ application (with + static linking). + +* Writing a small C/C++ wrapper around Python, hiding the fact that the + application is actually written in Python (to make a custom + command-line interface; for distribution purposes; or simply to make + it a bit harder to reverse-engineer the application). + The general idea is as follows: * You write and execute a Python script, which produces a ``.c`` file @@ -27,21 +42,6 @@ The general idea is as follows: C functions of your API, which are then used for all subsequent C function calls. -Possible use cases: - -* Exposing a library written in Python directly to C/C++ programs. - -* Using Python to make a "plug-in" for an existing program that is - already written to load them. - -* Using Python to implement part of a larger C/C++ application (with - static linking). - -* Writing a small C/C++ wrapper around Python, hiding the fact that the - application is actually written in Python (to make a custom - command-line interface; for distribution purposes; or simply to make - it a bit harder to reverse-engineer the application). - One of the goals of this approach is to be entirely independent from the CPython C API: no ``Py_Initialize()`` nor ``PyRun_SimpleString()`` nor even ``PyObject``. It works identically on CPython and PyPy. |