C calls FORTRAN subroutine

mather at uicsl.UUCP mather at uicsl.UUCP
Mon Oct 15 07:31:00 AEST 1984


I tried this little teaser of a program and nothing appears on
stdout, however, a little file called fort.6 is generated with the
contents:     subprogram
inside.

Some not-too-well-known info:

1) opening a file with "open(unit=n)" creates a file "fort.n"
	unless ioinit has been used to change the default. ioinit(3F)
	claims that there is no automatic filename association for
	fortran logical units, but there is. In libI77, see err.c.

2) It is difficult to pass C file descriptors to f77 as unit #s
	and visa versa.

3) Opening a file as "open(unit=n,file='/dev/tty')"  will put all output
	written on unit n to your tty. Impossible to separate standard
	output and standard error, however. I placed this open statement
	prior to the write and it worked, but this isn't good if you call
	this routine more than once, since it isn't nice to reopen a file
	if it is already open. It should be closed first. But closing,
	then opening puts the pointer at the beginning of the file (unless
	ioinit is used to make files appendable).


Callling C from FORTRAN is nice, but going the other way is a real pain,
especially since you have to include all of the libF77 and libI77 junk.
Messy messy messy.

					b.c.mather
					software surgeon
					uiucdcs!uicsl!mather



More information about the Comp.unix mailing list