fortranfortran-iso-c-bindingfortran2003

Fortran intrinsic keyword in module use statement


What does it mean when the intrinsic keyword is added to the use statement for a module, as in the following example?

  use, intrinsic :: iso_c_binding

(From 7.1 Overview of Fortran interface, FFTW 3.3.6-pl1)

Does it specify that a module of that name provided with the compiler should be used, even if there is another module of the same name written by the user?


Solution

  • With use, intrinsic :: ... the intrinsic module is indeed chosen.

    There is perhaps a slight subtlety in the question worth addressing. With regards to "a module of that name provided with the compiler should be used", this "should" doesn't indicate a preference but a strong requirement. That is, if there's no such intrinsic module then compilation cannot succeed. This shouldn't be a problem with iso_c_binding but compilers often offer their own non-standard intrinsic modules.

    There is no way to say "use the intrinsic module if it's available, but the user-provided one if not".