From jwagener@amoco.com Tue Feb 28 09:25:53 1995
Received: from interlock.amoco.com by dkuug.dk with SMTP id AA06127
  (5.65c8/IDA-1.4.4j for <SC22WG5@dkuug.dk>); Tue, 28 Feb 1995 22:26:34 +0100
Received: by interlock.amoco.com id AA06597
  (InterLock SMTP Gateway 3.0 for SC22WG5@dkuug.dk);
  Tue, 28 Feb 1995 15:26:41 -0600
Message-Id: <199502282126.AA06597@interlock.amoco.com>
Received: by interlock.amoco.com (Protected-side Proxy Mail Agent-3);
  Tue, 28 Feb 1995 15:26:41 -0600
Received: by interlock.amoco.com (Protected-side Proxy Mail Agent-2);
  Tue, 28 Feb 1995 15:26:41 -0600
Received: by interlock.amoco.com (Protected-side Proxy Mail Agent-1);
  Tue, 28 Feb 1995 15:26:41 -0600
From: jwagener@amoco.com
X-Openmail-Hops: 1
Date: Tue, 28 Feb 95 15:25:53 -0600
Subject: 
To: SC22WG5@dkuug.dk
X-Charset: ASCII
X-Char-Esc: 29

Item Subject: Text_1
     To X3J3 and WG5 -
     
     Even before the latest net-thread on interoperability, I had intended 
     to put the attached idea out for comment.  The recent exchanges have 
     inspired me to (try to) get my act together - hence the attached, 
     which I will submit to both the WG5 and X3J3 premeeting distributions.
     
     This concern about interoperability is coming from enough directions 
     that perhaps it's time to do more than just lament Fortran's 
     deficiencies in this area.  My hope is that the attached can help us, 
     in some way, get further down that road faster.
     
     Jerry

.......................................................................

Item Subject: interop.txt 2/28/95 2:23P
To:	WG5 and X3J3	X3J3/95-___	
From:	Jerry Wagener	Page 1 of 1
Subject:	Extrinsic C Interfaces


After the last WG5 meeting I sent the idea/possibility outlined below to the task force that WG5 established to investigate the general area of interoperability (e.g., between Fortran and C).  I would gladly defer to others on this topic, to run with either this idea or better ones.  However, with the recent flurry of "interoperate or die" message traffic, and the paucity of any concrete proposals to address this situation, perhaps it's time to dust this one off and send to a wider audience for review and comment.

This idea deals specifically with Fortran programs calling C procedures; extension to other procedure-call-oriented environments are (hopefully) obvious.  There are not many details supplied here, and there could be fatal flaws encountered while fleshing out those details.  

The basic approach is to combine the Fortran 90 interface block with  (an extension of) the extrinsic procedure concept.  The former is an effective tool for making explicit procedure interfaces that use the Fortran interprocedural linkage mechanisms.  The latter is intended to allow Fortran to call different language paradigms.  One assumption of this approach is that the processor knows about Fortran and the other environment (C in this case) and can provide the appropriate conversions/linkages if given high-level information about the entities to be associated across the interface.  The other main assumption is that the Fortran and C operational environments are disjoint except for the data entities communicated across the interface.

Within such a framework, a Fortran/C interface might take the following general form:
     
INTERFACE
	 EXTRINSIC (C) FUNCTION COO(P,Q,R,...)
		<type declaration of COO> 	::: 	<COO result as known to C>
 		<type declaration of P> 		::: 	<entity P as known to C>
  		<type declaration of Q> 	::: 	<entity Q as known to C>
  		<type declaration of R> 	::: 	<entity R as known to C>
			...
 	END FUNCTION COO
END INTERFACE

Note that the focus here is on "extrinsic" argument association, with the implementation taking care of any conversion/mapping that might be required for calls to COO from the Fortran program.

As presented here there are (essentially) two declarations for each argument - one on the Fortran side and one on the C side.  That would allow a Fortran call, for example, to have an integer actual argument that gets associated with a C longreal dummy argument.  The alternative (which is simpler in some respects and may be better) is to limit argument association to between prespecified types, for example between double precision real and longreal.

How important is this sort of capability to Fortran's long-term viability?  What will be the effect (if any) of delaying such interoperability functionality to F2000 (and perhaps years later for implementation)?  What are the options (if any) for getting it sooner?  Are these some key questions for Tokyo?

