Author: Maciej Fijalkowski <fij...@gmail.com> Branch: Changeset: r337:ce47621b4d77 Date: 2012-06-14 16:13 +0200 http://bitbucket.org/cffi/cffi/changeset/ce47621b4d77/
Log: (fijal, arigo) fix syntax + example diff --git a/README.md b/README.md --- a/README.md +++ b/README.md @@ -3,22 +3,29 @@ 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 ------- _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit