To said:
Can I compile the Fortran code
into Object file and then link to C++ code?
My thanks
In practice, usually yes. You'll have to
a) wrap the declaration inside 'extern "C"', as if you were
using C code
b) remember how Fortran passes parameters (like ints are
passed by pointer, not by value)
Also, you'll *probably* have to append an underscore ('_') to
C++ occurrences of the Fortran name and write them in
lower-case.
I also vaguely recall that Fortran indexes the arrays the
other way round (apart from indexing from 1), you might take
that into account.
An example:
// This uses the function DSYEVD from LAPACK, compiled with
// Fortran. In Fortran-land this function takes parameters
// of type: CHARACTER, CHARACTER, INTEGER, DOUBLE PRECISION,
// INTEGER, DOUBLE PRECISION, DOUBLE PRECISION,
// INTEGER, INTEGER, INTEGER, INTEGER.
// Notice how they are all passed by pointer, not by value
extern "C" void dsyevd_(char *job, char *uplo, int *n, double *a,
int *lda,double *w, double *work,
int *lwork,int *iwork, int *liwork, int *info);
HTH, use google,
- J.