c++调用fortran
用intel fortran 编译器编译fortran 代码,设置以下地方
fortran->compatibility->enable f77 runtime compatibility true
fortran->compatibility->use f77 integer constants true
fortran->diagnostics->check routine interfaces no
fortran->external procedures->append underscore to external names yes
在c++调用方
写
extern"C" {
void DGPADM_(INTEGER * ideg, INTEGER * m, double * t, double * H,
INTEGER * ldh, double * wsp, INTEGER * lwsp,
INTEGER * ipiv, INTEGER * iexph, INTEGER * ns, INTEGER * flag);
}
注意DGPADM才是本来fortran函数名,也就是说c++调用时需要在函数名后加下划线
ETIME是unix提供的一个fortran 函数,替换成CPU_TIME,具体如下
T1 = ETIME( TARRAY )
call CPU_TIME(T1)