Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29253 Discussions

Calling Fortran Subroutine Entry From C

jeff_monroe
Beginner
307 Views
Hello all,

I'm trying to call an Entry into aFortran subroutine from C and have managed to get everything to compile and link. But it crashes upon calling the Fortran code. I thought I had everything set up to pass the parameters correctly, but I guess I don't.

The fortran subroutine entry has the following arguments

ENTRY usr_tmblk_init (IINFO,RINFO, U,NU, X,F,NX,Y,NY,RPAR,IPAR)

where the paramaters are

INTEGER IINFO(*), IPAR(*), NU, NX, NY
DOUBLE PRECISION RINFO(*), RPAR(*), U(*), X(*), F(*), Y(*)

I've set up the extern to the functionin the C code as

extern void _stdcall usr_tmblk_init (int*, double*, double*, int *NU, double*, double*,int *NX,double*,int *NY, double*,int*);

and the calling code is

usr_tmblk_init ( finfo2, &T, U, &NU, X, XDOT, &NX, Y, &NY, RP, IP);

where T is a scalar in the C code, but the first element ofthe RINFOarray in the Fortran Code.
Compiler options are /nologo /MT /GNa /Op so I'm not doing anything to change the Fortran argument passing conventions. With this in mind I'm attempting to pass everything by reference. I will admit that my C and Fortran are both a little rusty.
Any help or thoughts would be appreciated.
Marcus
0 Kudos
0 Replies
Reply