Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utcs!mnetor!seismo!hao!woods From: woods@hao.UUCP Newsgroups: net.lang.f77 Subject: Re: Startup routines for f77 and C Message-ID: <156@hao.UUCP> Date: Mon, 21-Jul-86 01:03:50 EDT Article-I.D.: hao.156 Posted: Mon Jul 21 01:03:50 1986 Date-Received: Mon, 21-Jul-86 05:54:36 EDT References: <1709@eagle.ukc.ac.uk> Organization: High Altitude Obs./NCAR Boulder, CO Lines: 25 Summary: main() calls MAIN_() In article <1709@eagle.ukc.ac.uk>, map@ukc.ac.uk (M.A.Pralat) writes: > > '......the f77 and cc commands cause slightly different loading > sequences to be generated, since Fortran programs need a few extra libraries > and a different startup routine than do C programs' > My understanding is that when using ld(1), the entry point is ALWAYS called "main". In your f77 program, the main f77 routine is referred to as MAIN_ (any PROGRAM card is ignored). The startup routine for f77 programs is a C program that looks like main(argc,argv,envp) int argc; char **argv,**envp; { f_init(); MAIN_(); f_exit(); } The f_init and f_exit set up and close the F77 I/O drivers, which run with FORTRAN logical unit numbers on top of the usual UNIX file descriptors. This is similar to the stdio library, which uses stream pointers which run on top of the file descriptors, but of course the actual routines used are different. --Greg