C interoperability and C_LOC intrinsic

Thomas Koenig tkoenig@netcologne.de
Sun Sep 19 18:52:00 GMT 2010


Hi David,

> " 3 Argument. X shall have either the POINTER or TARGET attribute. It
> shall not be a coindexed object. It shall
> either be a variable with interoperable type and kind type parameters,

I've looked through the definition of "interoperable", and I don't find
any mention of pointers.  From this, I concur when you write

> I guess it centers around the "interoperable" type characteristic.  So
> an associated pointer to an array is considered not interoperable?

I didn't write the code in question, but yes, that would be my
interpretation as well.

However, I Am Not A Language Lawyer, so I might be wrong (which has
happened before :-)

Probably a post to comp.lang.fortran, with your two examples, would draw
useful responses.  Some former and current members of the Fortran
standards committee read there, and usually post replies.
 

>   real, dimension(:), allocatable, target :: A
>   real, pointer :: B
> 
>   allocate( A( 20 ) )
>   B => A( 1 )
> 
>   call my_c_func( c_loc( A ) )
>   call my_c_func( c_loc( B ) )

To me, this looks standard-conforming and a good way to get around that
limitation, but again a post to c.l.f. will probably bring more informed
responses.

	Thomas



More information about the Fortran mailing list