220. Use c_funloc() to pass a Fortran function as an argument to a C function.#

topic: Interoperability with C and C++

Note

This tip is a draft1.

A Fortran function can be passed as an argument to a C function. C_funloc(x) of iso_c_binding has a result of type(c_funptr) with the C address of function x or a pointer to a function.



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.