[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Proper way to link Fortran with C++

From: Jö Fahlke
Subject: Proper way to link Fortran with C++
Date: Tue, 23 Feb 2010 10:06:01 +0100
User-agent: Mutt/1.5.20 (2009-06-14)


Our project uses C++, but some of its optional dependencies require linking
with fortran libraries (like blas).  What is the proper way to do this?

On the one hand the Autoconf documentation says that the output variable FLIBS
should be included after LIBS when linking.  This is consistent with the
documentation for ACX_BLAS from the Autoconf archive, which states

#   To link with BLAS, you should link with:
#   in that order.

The Automake documentation on the other hand states that I should put $(FLIBS)
into the apropriate _LDADD or _LIBADD variable.  That would include the value
of FLIBS before the value of LIBS on the linker command line, contradicting
the autoconf documentation.

Is there a reason Autconf requires FLIBS after LIBS, and not just FLIBS after
the library actually using fortran?  That would be


in the case of blas, and it would allow me to fold FLIBS into BLAS_LIBS.  This
in turn would make it easier to omit the FLIBS completely in case blas was not
detected by configure.


Cernlib: turns your plain old PC into a quantum computer.

Attachment: signature.asc
Description: Digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]