concept iso_c_binding in category fortran

appears as: iso_c_binding
Modern Fortran: Building efficient parallel applications

This is an excerpt from Manning's book Modern Fortran: Building efficient parallel applications.

Before we venture into writing our own, custom modules, let’s first get familiar by accessing a built-in module that comes with Fortran out of the box. Fortran has a few built-in modules. The most commonly used one is iso_fortran_env, which, among other things, provides constants and procedures that allow you to write more portable programs. Another commonly used module is iso_c_binding, which allows you to interface functions and data in C and other languages. We’ll dig more into that in chapter 12.

Second, we import c_char from the iso_c_binding module. Like iso_fortran_env, iso_c_binding is a built-in module that’s specified by the standard and provided by the compiler. c_char is a type kind parameter, just like int64 and real64 from iso_fortran_env. Its purpose is to provide the exact type kind to interface with the character in the companion C compiler. A companion C compiler is simply the C compiler compatible with your Fortran compiler, and typically from the same vendor. For example, the companion C compiler to gfortran is gcc, and the companion C compiler to ifort (Intel Fortran) is icc (Intel C compiler).