Fortran Usage of Modules Intrinsic modules


Example

Fortran 2003 introduced intrinsic modules which provide access to special named constants, derived types and module procedures. There are now five standard intrinsic modules:

  • ISO_C_Binding; supporting C interoperability;
  • ISO_Fortran_env; detailing the Fortran environment;
  • IEEE_Exceptions, IEEE_Arithmetic and IEEE_Features; supporting so-called IEEE arithmetic facility.

These intrinsic modules are part of the Fortran library and accessed like other modules except that the use statement may have the intrinsic nature explicitly stated:

use, intrinsic :: ISO_C_Binding

This ensures that the intrinsic module is used when a user-provided module of the same name is available. Conversely

use, non_intrinsic :: ISO_C_Binding

ensures that that same user-provided module (which must be accessible) is accessed instead of the intrinsic module. Without the module nature specified as in

use ISO_C_Binding

an available non-intrinsic module will be preferred over the intrinsic module.


The intrinsic IEEE modules are different from other modules in that their accessibility in a scoping unit may change the behaviour of code there even without reference to any of the entities defined in them.