Using Fortran libraries from Python?

Carl phleum_nospam at chello.se
Thu Jun 17 15:44:03 CEST 2004


I have experimented with f2c and swig-generated wrappers to create python
modules from Fortran files. 

I think I'm missing something when I'm building the Python module, because
when I import the built module the Python interpreter returns the
following:

>>> import LDSsobol
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "LDSsobol.py", line 4, in ?
    import _LDSsobol
ImportError: /usr/lib/libf2c.so.0: undefined symbol: MAIN__

This is how I built LDSsobol:

> gcc -c LDSsobol.c
> gcc -c LDSsobol_wrap.c -I/usr/include/python
> gcc -shared LDSsobol.o LDSsobol_wrap.o -l f2c -o _LDSsobol.so

Any help is appreciated!

Carl



More information about the Python-list mailing list