Path: utzoo!attcan!uunet!timbuk!cs.umn.edu!ub.d.umn.edu!rutgers!usc!samsung!munnari.oz.au!mel.dit.csiro.au!yarra!pta!bgg From: bgg@pta.oz.au (Ben Golding) Newsgroups: comp.lang.fortran Subject: Re: Green Hills Fortran I/O init on Xenix Keywords: Calling Fortran from C Message-ID: <1918@pta.oz.au> Date: 23 Oct 90 05:47:50 GMT References: <2175@lupine.NCD.COM> Organization: Pyramid Technology Corporation, Sydney Lines: 27 In article <2175@lupine.NCD.COM> rfg@NCD.COM (Ron Guilmette) writes: >In article segall@caip.rutgers.edu (Ed Segall) writes: >>I'm working on an Intel iPSC/2, running Green Hills FORTRAN under >>Xenix. I've managed to successfully link C and Fortran routines (with >>the main procedure being in C), except for one nasty little detail: >> >>The fortran I/O doesn't work! > >I don't know why anybody would want to use third part fortran compilers >anymore, at least now that there is a public domain f2c (fortran to C) >translator and the GNU C compiler. One simple reason: support. Not everyone is prepared to use a product where they have to fix its bugs themselves. Ed's problem may be because the main() that is normally linked from Fortran's library initialises the I/O library before it calls the user's Fortran routine. Providing your own main() means that this initialisation isn't done. In the Pyramid compiler and many other unix Fortran implementations, the routine to do this is called f_init(). Try calling that before you call the Fortran subroutine. The corresponding routine to wind down the I/O library is f_exit(). If you get f_init and f_exit undefined, look through the namelist of the I/O library (traditionally /usr/lib/libI77) for another candidate. Ben Golding