Interfacing FORTRAN with C

Donald R. Fredkin ir10 at sdcc6.ucsd.EDU
Thu Dec 22 04:21:22 AEST 1988


In article <5962 at thorin.cs.unc.edu> singh at unc.cs.unc.edu (Raj Kumar Singh) writes:
>
>I think this question has been brought up before and so
>I would like to exchange info with some one who can provide
>helpful pointers on the issue of interprocedure calls between
>C program and FORTRAN routines.
>
>The specifics are as follows:
>
>System: VaxStation-3200 running Ultrix-2.1.  
>
>
>C-program {tt.c}
The following version works fine on a VaxStation-II running some flavor
or other of Ultrix.:
*******************************
#include <stdio.h>

extern void f_init(), f_exit(); /* fiddle with the Fortran I/O system */

MAIN_() /* f77 really wants this */
{
}

main()
{
	extern void hello_();

	f_init();
	hello_();
	f_exit();
	exit(0);
}
*******************************
>
>FORTRAN routine {hello.f}
unchanged.

I compile and link with the f77 command, which automatially includes
the right things from /usr/lib.
-- 

UUCP		{ihnp4,decvax!ucbvax,dcdwest,ucbvax}!ucsd.edu!drfredkin
Internet	drfredkin at ucsd.edu or drf%sdph2 at ucsd.edu
Bitnet		drfredkin at ucsd



More information about the Comp.lang.c mailing list