CFFI 1.1.0 released

23 views
Skip to first unread message

Armin Rigo

unread,
May 30, 2015, 3:56:25 PM5/30/15
to pytho...@googlegroups.com
Hi all,

CFFI 1.1.0 has been released, with a bunch of bugfixes and, more
interestingly, new features that have been talked about since a while
but that were not really easy to do before 1.0:

* Out-of-line API mode: we can now declare integer types with
``typedef int... foo_t;``. The exact size and signness of ``foo_t``
is figured out by the compiler. (The same might be added for
floats later, but isn't done so far.)

* Out-of-line API mode: we can now declare multidimensional arrays
(as fields or as globals) with ``int n[...][...]``. Before, only the
outermost dimension would support the ``...`` syntax.

* Out-of-line ABI mode: we now support any constant declaration,
instead of only integers whose value is given in the cdef. Such "new"
constants, i.e. either non-integers or without a value given in the
cdef, must correspond to actual symbols in the lib. At runtime they
are looked up the first time we access them. This is useful if the
library defines ``extern const sometype somename;``.

* ``ffi.addressof(lib, "func_name")`` now returns a regular cdata object
of type "pointer to function". You can use it on any function from a
library in API mode (in ABI mode, all functions are already regular
cdata objects). To support this, you need to recompile your cffi
modules.

* Issue #198: in API mode, if you declare constants of a ``struct``
type, what you saw from lib.CONSTANT was corrupted.

* Issue #196: ``ffi.set_source("package._ffi", None)`` would
incorrectly generate the Python source to ``package._ffi.py`` instead
of ``package/_ffi.py``. Also fixed: in some cases, if the C file was
in ``build/foo.c``, the .o file would be put in ``build/build/foo.o``.


This release 1.1 is done a couple of days before the final release of
PyPy 2.6 that will include it --- so now is a good time to find and
report bugs :-)


A bientôt,

Armin.
Reply all
Reply to author
Forward
0 new messages