This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

calling c++ from fortran


Hi.
I have a library written on Fortran 90, it does some calculations
with the user provided function

INTEGER, PARAMETER :: DP = SELECTED_REAL_KIND(15,70)

SUBROUTINE FDF(Z,F,DF)

COMPLEX(KIND=DP), INTENT(IN) :: Z
COMPLEX(KIND=DP), INTENT(OUT) :: F, DF
...

I want to wrap a call to a c++ function

// 'fcc.hpp'
extern "C"
void fcc(complex<double> z, complex<double> &f, complex<double> &df);

inside 'SUBROUTINE FDF'.
How do I do it, and how do I then link the fortran module with
the c++'s  object file 'fcc.o' ?

-- All compilations are done by GCC (or the 4.1.2 g++ and gfortran pair is used,
 or  the 3.4 g++ and g77 )
-- c++ runtime is properly initialized, as the program starts in c++, then calls
  fortran which then wants to call c++.

Thank you.
Dima.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]