From owner-sc22wg5@open-std.org  Tue Dec  9 21:47:18 2008
Return-Path: <owner-sc22wg5@open-std.org>
X-Original-To: sc22wg5-dom7
Delivered-To: sc22wg5-dom7@www2.open-std.org
Received: by www2.open-std.org (Postfix, from userid 521)
	id 6C103CA343D; Tue,  9 Dec 2008 21:47:18 +0100 (CET)
X-Original-To: sc22wg5@open-std.org
Delivered-To: sc22wg5@open-std.org
Received: from nspiron-2.llnl.gov (nspiron-2.llnl.gov [128.115.41.82])
	by www2.open-std.org (Postfix) with ESMTP id 7762BCA3439
	for <sc22wg5@open-std.org>; Tue,  9 Dec 2008 21:47:16 +0100 (CET)
X-Attachments: None
Received: from cyrus2.llnl.gov ([128.15.97.105])
  by nspiron-2.llnl.gov with ESMTP; 09 Dec 2008 12:47:15 -0800
From: Aleksandar Donev <donev1@llnl.gov>
Organization: LLNL
To: WG5 <sc22wg5@open-std.org>
Subject: Re: (j3.2006) (SC22WG5.3802) [ukfortran]    N1761, TYPE(*), BIND(C) and arrays
Date: Tue, 9 Dec 2008 12:47:15 -0800
User-Agent: KMail/1.9.4
References: <20081127193527.EF00DC178D9@www2.open-std.org> <20081209185450.B4B95CA3439@www2.open-std.org> <20081209203233.1E8AFCA3439@www2.open-std.org>
In-Reply-To: <20081209203233.1E8AFCA3439@www2.open-std.org>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Message-Id: <200812091247.15467.donev1@llnl.gov>
Sender: owner-sc22wg5@open-std.org
Precedence: bulk

On Tuesday 09 December 2008 12:32, N.M. Maclaren wrote:

> Bill keeps talking C calling Fortran. =A0Fine. =A0In THAT case, I agree
> that all of the arguments are dummy arguments. =A0That isn't the issue.
> =A0What about the case of Fortran calling C? =A0PLEASE take a look at
> that program and consider the issues.
What issues Nick? You sent an example program, which seemed perfectly=20
harmless to me, and I said that. Sorry I cannot read minds.

There is no difference between Fortran calling a Fortran BIND(C)=20
procedure and Fortran calling a C procedure. The compiler does exactly=20
the same thing in both cases, and it need not do any type of analysis=20
to figure out what the other procedure is written in. Exactly the same=20
restrictions on actual arguments apply (e.g., non-aliasing rules,=20
pointer association preservation rules, etc.). This is exactly how it=20
is now in C Interop.

In all of your examples, just write the procedure Slough in Fortran:

=A0 =A0 =A0 =A0 SUBROUTINE Slough (arg) BIND(C)
=A0 =A0 =A0 =A0 =A0 =A0 TYPE(*), DIMENSION(..) :: arg
             WRITE(*,*) "RANK=3D", RANK(arg)
=A0 =A0 =A0 =A0 END SUBROUTINE Slough

Is there a problem then? What is this problem, please explain. The=20
interoperable C interface is:

 	void slough(void * f_desc);

> you and Bill seem to do is to deny that problems exist, even if they
> are shown to exist (and be serious).
No, Reinhold, for example, brought some excellent points and I agree=20
with most of them, and have modified my own ballot (yet to be finished)=20
accordingly. You also made some good points (e.g., flexible array=20
members) in your comments, which I agree with and am ammending. What I=20
disagree with is your outrageous comment "this makes no sense, your=20
design is flawed from the basics, etc. etc." Sorry, it made sense to at=20
least 4 of us involved in writing it.

Best,
Aleks

=2D-=20
Aleksandar Donev, Ph.D.
Lawrence Postdoctoral Fellow @ Lawrence Livermore National Laboratory
High Performance Computational Materials Science and Chemistry
E-mail: donev1@llnl.gov
Phone: (925) 424-6816  Fax: (925) 423-0785
Address: P.O.Box 808, L-367, Livermore, CA 94551-9900
Web: http://cherrypit.princeton.edu/donev
