Author: Armin Rigo <ar...@tunes.org> Branch: cffi-1.0 Changeset: r2023:35283f41c772 Date: 2015-05-17 10:37 +0200 http://bitbucket.org/cffi/cffi/changeset/35283f41c772/
Log: in-progress diff --git a/TODO b/TODO --- a/TODO +++ b/TODO @@ -1,10 +1,3 @@ -* mention todo: ffi.new("xyz") makes {"xyz": <ctype>} always immortal - -* mention todo: dlopen(), by "compiling" a cdef()-only FFI into a .py module - -* ffi.set_source() produces a C file that is entirely independent on - the OS, what is installed, and the current Python version - * cffi_modules, now with the *path as a filename*! diff --git a/doc/source/cdef.rst b/doc/source/cdef.rst --- a/doc/source/cdef.rst +++ b/doc/source/cdef.rst @@ -407,7 +407,11 @@ **ffi.emit_c_code(filename):** generate the given .c file (for API mode) without compiling it. Can be used if you have some other method to compile it, e.g. if you want to integrate with some larger build -system that will compile this file for you. +system that will compile this file for you. You can also distribute +the .c file: unless the build script you used depends on the OS, the +.c file itself is generic (it would be exactly the same if produced on +a different OS, with a different version of CPython, or with PyPy; it +is done with generating the appropriate ``#ifdef``). **ffi.distutils_extension(tmpdir='build', verbose=True):** for distutils-based ``setup.py`` files. Calling this creates the .c file diff --git a/doc/source/using.rst b/doc/source/using.rst --- a/doc/source/using.rst +++ b/doc/source/using.rst @@ -594,6 +594,16 @@ assert ffi.typeof(ptr) is ffi.typeof("foo_t*") ... +Note also that the mapping from strings like ``"foo_t*"`` to the +``<ctype>`` objects is stored in some internal dictionary. This +guarantees that there is only one ``<ctype 'foo_t *'>`` object, so you +can use the ``is`` operator to compare it. The downside is that the +dictionary entries are immortal for now. In the future, we may add +transparent reclamation of old, unused entries. In the meantime, note +that using strings like ``"int[%d]" % length`` to name a type will +create many immortal cached entries if called with many different +lengths. + **ffi.CData, ffi.CType**: the Python type of the objects referred to as ``<cdata>`` and ``<ctype>`` in the rest of this document. Note that some cdata objects may be actually of a subclass of _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit