9.49 C_F_POINTER — Convert C into Fortran pointer
- Description:
-
C_F_POINTER(CPTR, FPTR[, SHAPE])
assigns the target of the C pointer CPTR to the Fortran pointer FPTR and specifies its shape. - Standard:
-
Fortran 2003 and later
- Class:
-
Subroutine
- Syntax:
-
CALL C_F_POINTER(CPTR, FPTR[, SHAPE])
- Arguments:
-
CPTR scalar of the type C_PTR
. It isINTENT(IN)
.FPTR pointer interoperable with cptr. It is INTENT(OUT)
.SHAPE (Optional) Rank-one array of type INTEGER
withINTENT(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:
© Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
https://gcc.gnu.org/onlinedocs/gcc-6.4.0/gfortran/C_005fF_005fPOINTER.html