calling c++ from fortran

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

 



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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux