HP Fortran Programmer's Guide (B3908-90031; September 2011)

Using Fortran directives
Using HP Fortran directives
Chapter 9210
external-name should 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$ ALIAS directive 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.
%REF specifies 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 %VAL and %REF are used with the CALL statement, they override the specification in the
$HP$ ALIAS directive. For detailed information about these built-in functions and their use in the CALL
statement, see the HP Fortran Programmers Reference..
Note the following restrictions:
Attempts to redefine $HP$ ALIAS names generate warning messages.
The compiler always uses external-name exactly as it is entered. No case transformations occur,
and no underscore is appended. The +ppu and +uppercase command-line options do not apply to
external names specified by the $HP$ ALIAS directive.
Local and global usage
The $HP$ ALIAS directive can be used either locally or globally, as follows:
The $HP$ ALIAS directive has local application only—that is, its effect is limited to a particular
program unit—if it appears within the boundaries of that program unit. To have local application only,
the directive must appear after any PROGRAM, SUBROUTINE, or FUNCTION statement and before the
first occurrence of name in the target program unit.
The $HP$ ALIAS directive has global application—that is, it applies to all subsequent program
units—if it appears outside and before the boundaries of those program units to which it is to apply.
Examples
The $HP$ ALIAS directive is especially useful when calling a routine in a language that uses different
conventions than Fortran. The following examples illustrate how to use the $HP$ ALIAS directive to
resolve differences with:
Case sensitivity
Argument-passing conventions
Strings