Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: Notesfiles $Revision: 1.6.2.17 $; site uicsl.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!mhuxj!ihnp4!inuxc!pur-ee!uiucdcs!uicsl!mather
From: mather@uicsl.UUCP
Newsgroups: net.unix
Subject: Re: Re: C calls FORTRAN subroutine
Message-ID: <11200003@uicsl.UUCP>
Date: Sun, 14-Oct-84 17:31:00 EDT
Article-I.D.: uicsl.11200003
Posted: Sun Oct 14 17:31:00 1984
Date-Received: Tue, 16-Oct-84 06:59:08 EDT
References: <1206@hao.UUCP>
Lines: 34
Nf-ID: #R:hao:-120600:uicsl:11200003:000:1268
Nf-From: uicsl!mather    Oct 14 16:31:00 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