3 use iso_c_binding
, only
: c_ptr
, c_loc
, c_f_pointer
5 integer, dimension(2,1,2), target
:: table
6 table
= reshape ( (/ 1,2,-1,-2/), (/2,1,2/))
7 call set_table (c_loc (table
))
9 subroutine set_table (cptr
)
10 type(c_ptr
), intent(in
) :: cptr
11 integer, dimension(:,:,:), pointer :: table_tmp
12 call c_f_pointer (cptr
, table_tmp
, (/2,1,2/))
13 if (any(table_tmp
/= table
)) call abort
14 end subroutine set_table