HP Fortran Programmer Guide (766160-001, March 2014)
In files that use free format, directives must start with the comment character!. In fixed format, they
must start with the comment character C, *, or !in column 1. Keywords and any arguments must
be delimited by at least one space character, as in the following:
!$HP$ OPTIMIZE ON
Using the comment character as the directive prefix ensures that, unless the compiler is specifically
looking for the directive, it is otherwise treated as a comment and ignored.
The following sections describe each of the HP Fortran directives.
$HP$ ALIAS
The ALIASdirective associates the name of a subroutine, function, entry, or common block with
an external name and specifies the parameter-passing conventions of routines written in other
languages.
Syntax
!$HP$ ALIAS name [= external-name ] [(arg-pass-mode-list)]
is the name used by the program to refer to a subroutine, function, or procedure entry point—but
not to an internal subroutine. If name is enclosed by slashes, it is a common block name.
name
is a character constant that specifies a standard symbolic name.external-name
is used only when name is that of a procedure that takes arguments. The items in the list specify
how the corresponding actual argument are to be passed. The items can be either of the
following built-in functions:
arg-pass-mode-list
• %VAL: pass the value of the actual argument
• %REF: pass the address of the actual argument
There must be as many items in the list as there are arguments in the procedure, they must be
separated by commas, and they must correspond positionally to the arguments.
Description and restrictions
The $HP$ ALIAS directive serves two purposes:
• It provides a way to associate the name used by your program when referring to a subroutine,
function, entry, or common block with a distinct external name. This feature is especially useful
when you want to access a variety of different graphics device drivers from the same source
code so that different hardware configurations can be supported.
• When used in conjunction with the %VALand %REFbuilt-in functions, it provides a way to direct
the compiler to use the appropriate parameter passing conventions to communicate with
routines written in other high-level languages. Using Fortran directives
external-nameshould never conflict with the name of an HP-UX system routine (described
in sections 2 and 3 of the HP-UX Reference) or with a Fortran library routine (for example,
OPEN, READ, or CLOSE). The $HP$ ALIASdirective applies to subroutines, entries, and
functions that are used externally. It does not apply to the main program unit.
%VAL is a built-in function that specifies that the value of the actual argument is to be passed to
the called procedure. You can use this parameter with all types of arguments. However, when
used with a procedure name, it has no effect; a pointer to the procedure is still passed.
%REFspecifies that the address of the actual argument is to be passed to the called procedure. For
non-character arguments, this is the default. For character arguments, %REF disables the passing
of the hidden length parameter.
When %VALand %REF are used with the CALL statement, they override the specification in the
$HP$ ALIASdirective. For detailed information about these built-in functions and their use in the
CALL statement, see the HP Fortran Programmer’s Reference.
124 Using Fortran directives