Using the FORTRAN90 Module Statement

F90_MODULE is a directory of FORTRAN90 programs which illustrate the use of the FORTRAN90 module statement.

For programmers familiar with older versions of FORTRAN, the module statement was an attempt. in part, to provide the functionality of the "common block" and the "include statement", while doing so in a cleaner, safer way, which also eased the use of certain other features of modern programming such as encapsulation, prescribed and checkable interfaces, and public/private data and functions.

In my opinion, the module statement is inadequate, poorly designed, documented, and implemented, and a regrettable further step down the road of making every single program a byzantine, inaccessible and unalterable labyrinth that compiles and runs for one set of data and one user under one compiler on one computer. Nonetheless, occasionally I have to use the module statement, or help other people who are using it, and for that reason I have thought a little about how it works.


The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.


F90_MODULE is available in a FORTRAN90 version.

Related Programs and Data:

F90_RETURN, FORTRAN90 programs which illustrates how a FORTRAN90 program can return a program status value to the calling environment.


  1. Jeanne Adams, Walter Brainerd, Jeanne Martin, Brian Smith, Jerrold Wagener,
    Fortran90 Handbook,
    Complete ANSI/ISO Reference,
    McGraw Hill, 1992,
    ISBN: 0-07-000406-4,
    LC: QA76.73.F28.F67.
  2. Ian Chivers, Jane Sleightholme,
    Introduction to Programming with Fortran,
    Springer, 2005,
    ISBN: 1846280532,
    LC: QA76.73.F29.C48.
  3. Miles Ellis, Ivor Philips, Thomas Lahey,
    Fortran90 Programming,
    Addison-Wesley, 1994,
    ISBN: 0-201-54446-6,
    LC: QA76.73.F25E435.
  4. Michael Metcalf,
    Fortran95/2003 Explained,
    Oxford, 2004,
    ISBN: 0198526938,
    LC: QA76.73.F235.M48.
  5. Larry Nyhoff, Sanford Leestma,
    Introduction to Fortran90 for Engineers and Scientists,
    Prentice-Hall, 1996,
    ISBN: 0135052157,
    LC: QA76.73.F25N925.
  6. James Ortega,
    An Introduction to FORTRAN90 for Scientific Computing,
    Oxford, 1994,
    ISBN: 0-19-517213-2,
    LC: QA76.73.O75.

Examples and Tests:

DUCK shows that, when multiple files are to be compiled, files defining modules must be compiled BEFORE files that invoke those modules. (This example was run on a Linux system, with the gfortran compiler. Its behavior, and the auxilliary files it creates, may vary in other environments.) (By the way, this example disclosed to me the appalling fact that if a function is defined in a module, then the type of the function must NOT be explicitly declared in any other procedures within the module, nor within any external procedure that "uses" the module, because in some vague and undocumented way, the module definition includes what amounts to a definition of the type of the function. Of course, for all I know, this behavior may also vary from compiler to compiler.)

You can go up one level to the FORTRAN90 source codes.

Last revised on 04 April 2013.