Fortran 90

5.2 Module and Use Statements
  • Modules create interface blocks automatically, eliminating possibility of a mismatch of interface with actual procedure data
     module fft1r_module
     contains
       subroutine fft1r(f, isign, indx)
       !rest of procedure goes here
       end subroutine fft1r
     end module fft1r_module
    
     program main
     use fft1r_module  !explicit interface not needed (automatic)
    
  • USE statement makes modules ``available'', like (but more powerful than) Fortran 77 INCLUDE extension
  • USE is not a text substitution; it is an implicit interface
One possible source of error is that one can mistakenly declare the data in an INTERFACE block to be different than the actual data in the procedure. This source of error is removed if the procedure is stored in a MODULE which is then "used," because in this case the compiler creates the INTERFACE automatically. The USE statement is similar to the INCLUDE extension commonly found in FORTRAN77, but it is not a text substitution. Rather, it makes information "available", and is much more powerful than the INCLUDE statement.