Xref: utzoo comp.lang.fortran:900 comp.unix.wizards:9809 comp.unix.questions:8131
Path: utzoo!utgpu!water!watmath!clyde!att!ucbvax!decwrl!labrea!denali!karish
From: karish@denali.stanford.edu (Chuck Karish)
Newsgroups: comp.lang.fortran,comp.unix.wizards,comp.unix.questions
Subject: Re: BSD 4.3 F77 fortran query
Summary: Passing open files from C to FORTRAN
Keywords: popen Fortran Units
Message-ID: <23037@labrea.Stanford.EDU>
Date: 11 Jul 88 14:35:23 GMT
References: <584632927.3487@bucasb.bu.edu>
Sender: news@labrea.Stanford.EDU
Reply-To: karish@denali.stanford.edu (Chuck Karish)
Organization: Mindcraft, Inc.
Lines: 23

In article <584632927.3487@bucasb.bu.edu> mike@bucasb.bu.edu (Michael Cohen) writes:
>Does anybody know an easy way to popen a stream which can be passed
>to Fortran and associated with a fortran Unit,.  This is for a version
>of BSD4.3 F77.  What was already tried was a fortran open followed
>by a dup2 using the fortran unit as a file descriptor as passed to C.

	There's no really portable way to do this, even among different
	ports of 4.x.  A colleague of mine wrote some code to do this
	under 4.2.  It uses low-level calls within the stdio library,
	and depends on knowledge of exactly how a file descriptor and a
	FORTRAN logical unit are implemented.  

	When I ported the code to Convex Unix (on a binary-only
	system), I had to guess about the changes in the internal
	interface.  I got lucky, and it worked for a while.  There's
	nothing to keep Convex from streamlining their stdio library
	and replacing or changing the name of one crucial interface, at
	which point my code dies.

Chuck Karish	ARPA:	karish@denali.stanford.edu
		BITNET:	karish%denali@forsythe.stanford.edu
		UUCP:	{decvax,hplabs!hpda}!mindcrf!karish
		USPS:	1825 California St. #5   Mountain View, CA 94041