[pypy-dev] Include .so modules generated with f2py from fortran script

Armin Rigo arigo at tunes.org
Tue May 14 17:59:52 CEST 2013

Hi Fabio,

On Tue, May 14, 2013 at 5:31 PM, Fabio D'Orta <fabio88.dorta at gmail.com> wrote:
> thanks for your reply.
> The problem with CFFI regards the "undefined symbol: PyMem_Free" when I use
> ffi.dlopen.

Ah, you're trying to import an .so that is a CPython C extension
module.  That's not what CFFI is for.  With CFFI you can connect
directly to C (and probably Fortran) code that is not specifically
written for Python (i.e. doesn't contain "#include <Python.h>").

You can call C code from Python with CFFI; this C code may be living
in its own (Python-independent) .so file, or may just be more sources
that will be compiled along during the call to ffi.verify() if you use
"sources=[...]".  Look up http://cffi.readthedocs.org for more

A bientôt,


More information about the pypy-dev mailing list