02.07.2013 Views

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Program units and procedures<br />

Modules<br />

Modules<br />

A module is a nonexecutable program unit that contains—usually related—definitions and<br />

declarations that may be accessed by use association. Typically, modules are used for:<br />

158<br />

Defining and declaring derived types<br />

Defining and declaring global data areas<br />

Defining operators<br />

Creating subprogram libraries<br />

The definitions within a module are made accessible to other program units through use<br />

association. The program unit that requires access to the module must have a USE statement<br />

at the head of its specification part, and the statement must specify the name of the module.<br />

The following sections describe the module program unit and the USE statement. The last<br />

section gives an example program that uses a module.<br />

NOTE Compiling programs that contain modules requires care to ensure that each<br />

module is compiled before the program unit that uses it. For detailed<br />

information about compiling programs that contain modules, refer to the<br />

<strong>HP</strong> <strong>Fortran</strong> Programmer’s Guide.<br />

Module program unit<br />

The syntax of a module program unit is:<br />

MODULE module-name<br />

[specification-part]<br />

[module-procedure-part]<br />

END [MODULE [module-name]]<br />

where:<br />

module-name<br />

specification-part<br />

isthenameofthemodule.<br />

Chapter 7

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!