Calling C from FORTRAN under Unix

Tony Buckland buckland at ucs.ubc.ca
Sat May 18 02:34:21 AEST 1991


In article <5343 at dftsrv.gsfc.nasa.gov> packer at amarna.gsfc.nasa.gov writes:
>On a Unix system I want to call a C routine from a FORTRAN
>program. The linker says the C routine is undefined.
>To anyone familiar with this problem: what is the way around it? 

 The technique I have used is to write a little interface routine
 with its entry point having the name the FORTRAN program wants
 to call, and which calls the entry point the C routine provides.
 This was done to call a C library routine.  It works as long as
 the C library routine is FORTRAN-callable in the first place;
 otherwise, the little interface routine has to get bigger, so
 that it can transform between the argument lists provided by
 the FORTRAN program and desired by the C routine.



More information about the Comp.lang.c mailing list