[Numpy-discussion] F2PY and underscore problem

Zdeněk Hurák hurak@fel.cvut...
Thu Apr 5 07:22:17 CDT 2007


I am sorry to come up with a question that probably has been asked and
answered many times but I honestly searched for an answer but failed to
find one.

I want to create Python modules from some Fortran numerical functions that
rely on LAPACK. I start with a function SB02MD.f that provides a solver for
algebraic Riccati equation (ARE) that can be obtained at
http://www.slicot.de/. I proceeded the standard f2py way:

f2py SB02MD.f -m are -h are1.pyf

modified are1.pyf (saved as are.pyf) to tell which arguments are inputs and
outputs and compiled the module:

f2py -c are.pyf SB02MD.f --link-lapack_opt

However, when trying to import the module, Python cries that there is and
undefined symbol: sb02mw_. The same situation if I omit --link-lapack_opt.

The famous underscore problem. Perhaps important information is that I am on
Linux and experience this problem both with lapack-atlas and
lapack-reference libraries. Why I am so focused on Lapack? Some other
examples for f2py that do not need Lapack work well here.  

Even though Google gives miriad of links for "f2py underscore" problem, I
failed to find the one that is relevant for me. I played with the options
like -DUNDERSCORE_G77 and -DNO_APPEND_FORTRAN but no help and I actually do
not understand their use at all (not explained in man for f2py).

Thanks for whatever hint/advice.


-- 
------------------------------------------------
Zdenek Hurak
Czech Technical University in Prague
------------------------------------------------



More information about the Numpy-discussion mailing list