summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorMaciej Fijalkowski <fijall@gmail.com>2012-06-14 16:13:54 +0200
committerMaciej Fijalkowski <fijall@gmail.com>2012-06-14 16:13:54 +0200
commit714c0514b3a70f33dd251bd13553f6934534ce66 (patch)
tree1c3bbdd85948a6821040c185aef31f2b98526a30 /README.md
parentdce5a0769a8b17d1ccdfed5e7435efcdab2e2e8a (diff)
downloadcffi-714c0514b3a70f33dd251bd13553f6934534ce66.tar.gz
(fijal, arigo) fix syntax + example
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
-------