FORTRAN Reference Manual

Mixed-Language Programming
FORTRAN Reference Manual528615-001
13-23
Calling FORTRAN Procedures From Other
Languages
2. Delete dummy values used as placeholders for omitted arguments. If the omitted
arguments are at the end of the argument list, delete them completely; if the
omitted arguments precede other arguments that you supply in the list, use
successive commas to skip them.
3. Delete the backslashes (\) that surround pass-by-value arguments.
You must make the changes listed in steps 1 and 2, but you do not have to remove the
backslashes as indicated in step 3. FORTRAN generates warning messages if it finds
backslashes surrounding pass-by-value arguments in calls to routines declared in
procedures that are not written in FORTRAN, but it generates correct code in spite of
the warning.
Calling FORTRAN Procedures From Other
Languages
If you write a program in a language other than FORTRAN and this program calls a
FORTRAN subprogram, you must observe the following rules:
Declare the FORTRAN subprogram in the manner that the calling program’s
language requires.
Write calls to it in such a way that parameter passing will work as described in The
FORTRAN Calling Sequence on page 13-7, so that the FORTRAN subprogram
receives the calling sequence that it expects.
Don’t call a FORTRAN type CHARACTER function from another language,
because FORTRAN expects a zero-th parameter through which to return the
function result value.
Calling FORTRAN Subprograms From TAL
If you write a TAL procedure that calls a FORTRAN subprogram, you must write TAL
text to declare the FORTRAN subprogram as a TAL external procedure.
If the FORTRAN subprogram is compiled with an EXTENDEDREF, LARGECOMMON,
or LARGEDATA directive, declare all the address parameters in the TAL external
declaration as extended reference parameters—that is, declared with .EXT, as in the
following example:
PROC fort_sub = "THE_SUB" (a, b, c) LANGUAGE FORTRAN;
INT .EXT a,
.EXT b,
.EXT c;
EXTERNAL;