Tuesday, June 8, 2010

How to Use Fortran Code in C++

Declare the Fortran function first:

extern "C"{
    // double precision dot product:
    double ddot_(
            const int*        n,      // dimension
            const double*     dx,     // []vector x
            const int*        incx,   // index increment of each access of x
            const double*     dy,     // []vector y
            const int*        incy    // index increment of each access of y
    );
}

Then use it.

No comments:

Post a Comment