[Top][All Lists]

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

Checking g77 or gfortan calling convention for c++

From: Klaas Vantournhout
Subject: Checking g77 or gfortan calling convention for c++
Date: Sat, 08 Mar 2008 22:55:10 +0100
User-agent: Thunderbird (X11/20080305)


I need to use complex functions from a fortran library in a c/c++ code.

As I have seen there are two calling conventions for complex functions.

g77 used the following calling convention.
Functions that return type default REAL actually return the C type
double, and functions that return type COMPLEX return the values via an
extra argument in the calling sequence that points to where to store the
return value.

In gfortran this behaviour changed for functions returning a COMPLEX
type, it basically returns now a c struct representing a complex value
or in c++ it returns std::complex<double>.

I am wondering if it is possible for autoconf to check the above calling
convention of a library.

An example of such a library would be for example the blas libray. A g77
complied blas library function would be called in c++ as

extern "C" {
void cdotc_(std::complex<float> *result, long *, std::complex<float> *,
long *, std::complex<float> *, long *);

While the gfortran version would be

extern "C" {
std::complex<float> cdotc_(long *, std::complex<float> *, long *,
std::complex<float> *, long *);

Is there any test for this?

Thanks in advance.

"Several billion trillion tons of superhot
exploding hydrogen nuclei rose slowly above
the horizon and managed to look small, cold
and slightly damp."
        Douglas Adams - The Hitch Hickers
                Guide to the Galaxy

reply via email to

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