From owner-sc22wg5@open-std.org  Sat Jul 26 00:38:28 2008
Return-Path: <owner-sc22wg5@open-std.org>
X-Original-To: sc22wg5-dom6
Delivered-To: sc22wg5-dom6@open-std.org
Received: by open-std.org (Postfix, from userid 521)
	id 2DED1DE4B9; Sat, 26 Jul 2008 00:38:28 +0200 (CET DST)
X-Original-To: sc22wg5@open-std.org
Delivered-To: sc22wg5@open-std.org
Received: from mail1.cray.com (mail1.cray.com [136.162.0.111])
	by open-std.org (Postfix) with ESMTP id 80BCB60EE7
	for <sc22wg5@open-std.org>; Sat, 26 Jul 2008 00:38:14 +0200 (CET DST)
Received: from beaver.us.cray.com (beaver.us.cray.com [172.30.74.51])
	by mail1.cray.com (8.13.6/8.13.3/gw-5323) with ESMTP id m6PMbj2s012752
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
	Fri, 25 Jul 2008 17:37:46 -0500 (CDT)
Received: from CFEXFE01.us.cray.com (cfexfe01.us.cray.com [172.30.74.93])
	by beaver.us.cray.com (8.13.8/8.13.3/hub-5273) with ESMTP id m6PMbix8030321;
	Fri, 25 Jul 2008 17:37:44 -0500
Received: from mh-dhcp-172-31-20-57.us.cray.com ([172.31.20.57]) by CFEXFE01.us.cray.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959);
	 Fri, 25 Jul 2008 17:37:44 -0500
Message-ID: <488A55C0.5000906@cray.com>
Date: Fri, 25 Jul 2008 17:37:52 -0500
From: Bill Long <longb@cray.com>
Reply-To: longb@cray.com
Organization: Cray Inc.
User-Agent: Thunderbird 2.0.0.9 (Macintosh/20071031)
MIME-Version: 1.0
To: Jim Xia <jimxia@ca.ibm.com>
CC: sc22wg5 <sc22wg5@open-std.org>
Subject: Re: (j3.2006) (SC22WG5.3591) Assumed-type and Assumed-rank extensions
 for C Interop TR.
References: <OF19D03DFA.2D4C3642-ON85257491.0067A55B-85257491.00684DA0@ca.ibm.com>
In-Reply-To: <OF19D03DFA.2D4C3642-ON85257491.0067A55B-85257491.00684DA0@ca.ibm.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-OriginalArrivalTime: 25 Jul 2008 22:37:44.0508 (UTC) FILETIME=[0E30AFC0:01C8EEA7]
X-Cray-VirusStatus: clean
Sender: owner-sc22wg5@open-std.org
Precedence: bulk



Jim Xia wrote:
>
> Bill Long <longb@cray.com> wrote on 07/25/2008 02:38:50 PM:
>
> > > The basic problem is Fortran side can not use this type directly.  If
> > > the procedure is defined in Fortran for C, then how can a Fortran
> > > programmer "map" this dummy argument to real Fortran data type.
> >
> > In what way does C_F_POINTER fail to solve this problem?  It was
> > explicitly designed to be used on the Fortran side to give a Fortran
> > type, type parameters, and shape to a block of memory pointed to by a C
> > address.
>
>
>
> Read what's written in C_F_POINTER on page 394
>
>
> (1) If the value of CPTR is the C address of an interoperable data
> entity, FPTR shall be a data pointer with type and type parameters
> interoperable with the type of the entity. In this case, FPTR
> becomes pointer associated with the target of CPTR. If FPTR is
> an array, its shape is specified by SHAPE and each lower bound
>

Option 1 is the one we want to apply.  If the wording of the draft is 
such that these conditions are not met, then fixes are needed.
>
>
> In any case, it is asking for the pointer association.  I don't see 
> how TYPE(*) can fit in here yet.
>

The FPTR argument was declared integer,pointer,dimension(:),  so it is 
clearly a pointer. The effect of executing c_f_pointer is to cause that 
pointer to be associated with the target of CPTR, which in this case is 
the buffer that was declared type(*).    C_F_POINTER does not ask for 
pointer association, it causes pointer association.

Cheers,
Bill

>
> Cheers,
>
> Jim Xia
>
> RL Fortran Compiler Test
> IBM Toronto Lab at 8200 Warden Ave, Markham, On, L6G 1C7
> Phone (905) 413-3444  Tie-line 313-3444
> email: jimxia@ca.ibm.com
> D2/YF7/8200 /MKM

-- 
Bill Long                                   longb@cray.com
Fortran Technical Support    &              voice: 651-605-9024
Bioinformatics Software Development         fax:   651-605-9142
Cray Inc., 1340 Mendota Heights Rd., Mendota Heights, MN, 55120

            

