FORTRAN Reference Manual

Mixed-Language Programming
FORTRAN Reference Manual528615-001
13-16
Calling Routines Without Using GUARDIAN and
CONSULT Directives
Arguments passed by reference must pass word or doubleword addresses,
according to the requirements of the called procedure. All parameters passed by
reference must have the same size address, either word or doubleword. If the
called procedure expects word addresses, the FORTRAN program must not be
compiled with any EXTENDEDREF, LARGECOMMON, or LARGEDATA compiler
directives. If the called procedure expects doubleword addresses, the FORTRAN
program must be compiled with at least one of these compiler directives.
For example, a TAL procedure that begins
PROC flipout (input, output);
INT .input;
INT .EXT output;
cannot be called from a FORTRAN program, because the first parameter, INPUT,
requires a word address and the second parameter, OUTPUT, requires a
doubleword address, but a single FORTRAN program cannot have both word and
doubleword addresses unless the procedure is declared with a GUARDIAN or
CONSULT directive.
Parameters passed by value must be surrounded by backslash characters in the
argument list, as in the following example:
CALL procedurename ( ... , \X\, ... )
You cannot pass arrays nor can you pass type character values by value. Using
backslash characters around value parameters is an HP extension to the ANSI
FORTRAN language standard.
If a procedure has an optional parameter that you want to omit in a particular call,
you must include a “dummy” value to serve as a placeholder in the argument list. If
the parameter is passed by value, you can supply a dummy argument like this:
CALL procedurename ( ... , \0\, ... )
If you want to omit a value for a multiple-word optional parameter that is passed by
value, you must supply multiple dummy values to serve as placeholders for each
word that corresponds to that parameter. For example, you can omit a doubleword,
optional, pass-by-value parameter like this:
CALL procedurename ( ... , \0\, \0\, ... )
In this case, you must violate the rule “parameters must match in number” in order
to fulfill the rule “parameters must match in type.”
If a procedure has optional parameters, you must also supply a “mask” parameter
as an extra, final parameter, which does not appear in the formal parameter list in
the procedure’s declaration in its source language. The exact format of the mask
depends on whether the procedure is declared VARIABLE or EXTENSIBLE.
Masks for VARIABLE procedures: