218. Use TYPE(C_PTR) and C_F_POINTER to call a C function returning a pointer.#

topic: Interoperability with C and C++

Note

This tip is a draft1.

In ISO_C_BINDING, TYPE(C_PTR) holds a C pointer, and C_F_POINTER(CPTR,FPTR[, SHAPE]) associates the target of a C pointer to a Fortran pointer. Use them to call a C function that returns a pointer, possibly to an unknown amount of data.



1

From the perspective of FortranTip Browser, “draft” means that it hasn’t been edited for formatting, hasn’t had corresponding Fortran programs added, the text content hasn’t been enhanced, etc. Draft texts are extracted from the corresponding Tweet using the Twitter API.