summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md17
1 files changed, 12 insertions, 5 deletions
diff --git a/README.md b/README.md
index ed35061..9b3b7d4 100644
--- a/README.md
+++ b/README.md
@@ -3,22 +3,29 @@ cffi
Foreign Function Interface for Python calling C code. The aim of this project
is to provide a convinient and reliable way of calling C code from Python.
-The interface is based on `luajit FFI`_ and follows few principles:
+The interface is based on [luajit FFI](http://luajit.org/ext_ffi.html) and follows a few principles:
-* Able to call C from Python without introducing a third language
- (unlike Cython or SWIG)
+* You want to use C code from Python code, so you should be able to do so
+ without needing to learn a 3rd language
+ (unlike Cython or SWIG or ctypes)
* Keep all the python-related logic in Python instead of C (unlike CPython
native C extensions)
* Be complete and work on the level of API (unlike ctypes)
-.. _`luajit FFI`: http://luajit.org/ext_ffi.html
+.. _`luajit FFI`:
Simple example
--------------
-xxx
+ >>> from cffi import FFI
+ >>> ffi = FFI()
+ >>> ffi.cdef("""
+ ... int printf(const char *format, ...);
+ ... """)
+ >>> C = ffi.rawload(None) # loads what?
+ >>> C.printf("hi there, %s!\n", "world");
Contact
-------