Using Fortran libraries from Python?

Carl phleum_nospam at
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

>>> import LDSsobol
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "", line 4, in ?
    import _LDSsobol
ImportError: /usr/lib/ 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

Any help is appreciated!


More information about the Python-list mailing list