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

Fabio D'Orta fabio88.dorta at gmail.com
Tue May 14 17:31:54 CEST 2013

Hi Armin,

thanks for your reply.
The problem with CFFI regards the "undefined symbol: PyMem_Free" when I use

Trying to import the f2py builted up library 'libprovaf2py.so' from pypy
shell, I obtain the following error:

>>>>from cffi import FFI
>>>>ffi = FFI()
>>>>import ctypes.util
>>>># Verifying if ctypes find libprovaf2py.so
>>>># Trying to open libprovaf2py.so
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/fabio/Desktop/PyPy2.0/pypy-2.0/lib_pypy/cffi/api.py", line
111, in dlopen
    lib, function_cache = _make_ffi_library(self, name, flags)
  File "/home/fabio/Desktop/PyPy2.0/pypy-2.0/lib_pypy/cffi/api.py", line
365, in _make_ffi_library
    backendlib = backend.load_library(path, flags)
OSError: cannot load library libprovaf2py.so:
/usr/lib/x86_64-linux-gnu/libprovaf2py.so: undefined symbol: PyMem_Free

I'm using pypy 2.0 which includes CFFI on ubuntu 12.04 LTS. Don't know if
may help, on linux shell (bash) the comand "nm libprovaf2py.so" show me
that PyMem_Free is undefined. However, the same module imported directly
without CFFI in CPython works.

PS: the library 'libprovaf2py.so' is a simple test fortran90 subroutine
which accept an integer input and print it to screen.

Thanks again.

A presto,


2013/5/14 Armin Rigo <arigo at tunes.org>

> Hi Fabio,
> On Tue, May 14, 2013 at 12:04 PM, Fabio D'Orta <fabio88.dorta at gmail.com>
> wrote:
> > stuck in finding a way to ingest the .so module into pypy. I have tried
> with
> > CFFI but with no luck.
> This is what I would recommend you to try: CFFI.  We cannot help you
> more without any more information about what the problem is, though.
> A bientôt,
> Armin.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20130514/9bc7968b/attachment.html>

More information about the pypy-dev mailing list