Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP Fortran Compiler for HP-UX: HP Fortran Programmer's Reference > Chapter 10 HP Fortran statements

EXTERNAL (statement and attribute)

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Glossary

 » Index

Declares a name to be external.

Syntax

A type declaration statement with the EXTERNAL attribute is:

type , attrib-list :: function-name-list
type

is a valid type specification (INTEGER, REAL, LOGICAL, CHARACTER, TYPE (name), etc.).

attrib-list

is a comma-separated list of attributes including EXTERNAL and optionally those attributes compatible with it, namely:

Table 10-10 Title not available (EXTERNAL (statement and attribute))

OPTIONAL

PRIVATE

PUBLIC

 

function-name-list

is a comma-separated list of function names to be designated EXTERNAL.

The syntax of the EXTERNAL statement is:

EXTERNAL external-name-list

Note that the syntax of the EXTERNAL statement does not permit optional colons.

Description

An EXTERNAL attribute or statement specifies that a name may be used as an actual argument in subroutine calls and function references. The name is either an external procedure, a dummy procedure, or a block data program unit.

A name that appears in a type statement specifying the EXTERNAL attribute must be the name of an external procedure or of a dummy argument that is a procedure.

The following rules and restrictions apply:

  • A name can appear once in an EXTERNAL statement, in a declaration statement with an EXTERNAL attribute, or in an interface body, but not in more than one of these.

  • The EXTERNAL attribute cannot be used with subroutines. To declare a subroutine as EXTERNAL, use the statement form.

  • If the name is a dummy argument, an EXTERNAL statement declares it to be a dummy procedure.

  • If a user-defined procedure or library routine has the same name as an intrinsic procedure, then it must either be declared to have the EXTERNAL attribute or have an explicit interface. The intrinsic procedure is then no longer available in such program units.

  • The INTRINSIC and EXTERNAL attributes are mutually exclusive.

Examples

SUBROUTINE sub (fourier)
! fourier is a dummy procedure; actual argument corresponding to
! to fourier can be external, intrinsic, or module procedure
REAL fourier
EXTERNAL fourier ! statement form
REAL, EXTERNAL :: SIN, COS, TAN ! attribute form
! SIN, COS, and TAN are no longer intrinsic procedures; functions
! with these names must be defined in the program
...
END SUBROUTINE sub
SUBROUTINE gratx (x, y)
! Specify init_block_a as the block data
! subprogram that initializes common block a
EXTERNAL init_block_a
! Common block available in subroutine gratx
COMMON /a/ temp, pressure
END SUBROUTINE gratx

BLOCK DATA init_block_a
! init_block_a initializes the objects in common block a
COMMON /a/ temp, pressure
DATA temp, pressure/ 98.6, 15.5 /
END BLOCK DATA init_block_a

Related statements

INTRINSIC

Related concepts

For related information, see the following:

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© Hewlett-Packard Development Company, L.P.