(j3.2006) (SC22WG5.4382) [ukfortran] WG5 informal ballot re Interop. TR

Bill Long longb
Mon Dec 6 15:08:32 EST 2010



On 12/6/10 1:03 PM, Aleksandar Donev wrote:
> On 12/06/10 13:24, Bill Long wrote:
>> If we make that the case, then we have to also allow a C function to
>> call a BIND(C) Fortran subprogram that has a CLASS(*) dummy
> No we don't Bill. An interface with a CLASS(*) dummy is NOT
> interoperable and no one has proposed to make it so. An interface with
> TYPE(*) dummy is. The question is: Can the actual argument be CLASS(*)
> or not.
>
> interface
>       subroutine sub(x) bind(c)
>           type(*), dimension(:) :: x
>       end subroutine
> end interface
>
> CLASS(*), ... :: x(:)
>
> ! Is this allowed and what does the C descriptor get filled with?

I do not see anything that prohibits this.  For this to be valid, the 
actual argument would have to actually have a dynamic type at the point 
of the call below, and be allocated / pointer associated. So the basic 
information needed in the C descriptor seems to be available.

> call sub(x(1:10:2))
>

Even call sub(x) seems OK here.

However, if the dummy were allocatable or pointer, then for the sub(x) 
call,  both the dummy and actual need to be "unlimited polymorphic". 
This is nominally the case if TYPE(*) is unlimited polymorphic, but I 
see this as one of those cases where the base standard might need 
modification to require CLASS(*) instead of "unlimited polymorphic".

Cheers,
Bill


> Aleks
>

-- 
Bill Long                                           longb at cray.com
Fortran Technical Support    &                 voice: 651-605-9024
Bioinformatics Software Development            fax:   651-605-9142
Cray Inc./Cray Plaza, Suite 210/380 Jackson St./St. Paul, MN 55101





More information about the J3 mailing list