Clicky

Fortran Wiki
c_f_pointer (changes)

Skip the Navigation Links | Home Page | All Pages | Recently Revised | Authors | Feeds | Export |

Showing changes from revision #3 to #4: (追記) Added (追記ここまで) | (削除) Removed (削除ここまで) | (削除) Chan (削除ここまで)(追記) ged (追記ここまで)

Description

c_f_pointer(cptr, fptr[, shape]) Assign the target, the C pointer, cptr to the Fortran pointer fptr and specify its shape.

Standard

Fortran 2003 and later

Class

Subroutine

Syntax

(削除)

call c_f_pointer(cptr, fptr[, shape])

(削除ここまで)
(追記)
call c_f_pointer(cptr, fptr[, shape])
(追記ここまで)

Arguments

  • cptr - scalar of the type c_ptr. It is intent(in).
  • fptr - pointer interoperable with cptr. It is intent(out).
  • shape - (Optional) Rank-one array of type integer with intent(in). It shall be present if and only if fptr is an array. The size must be equal to the rank of fptr.

Example

program main
 use iso_c_binding
 implicit none
 interface
 subroutine my_routine(p) bind(c,name='myC_func')
 import :: c_ptr
 type(c_ptr), intent(out) :: p
 end subroutine
 end interface
 type(c_ptr) :: cptr
 real,pointer :: a(:)
 call my_routine(cptr)
 call c_f_pointer(cptr, a, [12])
end program main

See also

c_loc, c_f_procpointer, iso_c_binding

category: intrinsics

Revised on April 4, 2016 12:39:36 by Jason Blevins (128.146.137.52) (1104 characters / 0.0 pages)
Edit | Back in time (3 revisions) | Hide changes | History | Views: Print | TeX | Source | Linked from: Intrinsic procedures, c_f_procpointer, c_funloc, c_loc, C interoperability, iso_c_binding

AltStyle によって変換されたページ (->オリジナル) /