C interoperability and C_LOC intrinsic

Thomas Koenig tkoenig@netcologne.de
Sat Sep 18 22:18:00 GMT 2010


Am Samstag, den 18.09.2010, 11:22 -0400 schrieb David Car:
> I was trying out the ISO_C_BINDINGS module and the use of the C_LOC
> intrinsic.  I thought that the standard allowed either an allocatable
> or pointer as the argument to C_LOC.  For instance,
> 
> program main
> 
>   real, allocatable, dimension(:) :: A
>   real, pointer, dimension(:) :: p_A
> 
>   allocate( A )
>   p_A => A
> 
>   call my_c_func( c_loc( A ) )
>   call my_c_func( c_loc( p_A ) )
> 
>   deallocate( A )
> 
> end program

This program contains at least two errors (missing TARGET on A
and missing dimension spec in the allocate statement).

Can you show us a program that we could use to reproduce the
behavior you are describing?

	Thomas



More information about the Fortran mailing list