FORTRAN Reference Manual

Mixed-Language Programming
FORTRAN Reference Manual528615-001
13-21
Calling Pascal Subprograms From FORTRAN
If the FORTRAN program does not declare the C subprogram with a GUARDIAN
or CONSULT directive:
°
If the FORTRAN program is compiled with any EXTENDEDREF,
LARGECOMMON, or LARGEDATA directives, the called C subprogram must
be compiled with the XMEM directive, so that the C subprogram will expect the
doubleword-address arguments that FORTRAN passes.
°
Otherwise, the called C subprogram must be compiled with the NOXMEM
directive, so that the C subprogram will expect the word-address arguments
that FORTRAN generates in this case.
If the C subprogram’s function type is “void,” it must be invoked by a CALL
statement in FORTRAN; otherwise, it must be invoked by a function reference.
If the C subprogram’s function type is “char” or “unsigned char,” FORTRAN
considers the function to be a CHARACTER*1 function.
For a C type “char” or “unsigned char” formal parameter passed by value,
FORTRAN allows a CHARACTER*1 expression or an integer constant with value
in the range 0 through 255 as the actual argument.
For a C type “unsigned int” formal parameter passed by value, FORTRAN allows
an integer constant with value in the range 0 through 65,535 as the argument.
For a C type “unsigned long int” formal parameter passed by value, FORTRAN
allows an integer constant with value in the range 0 through 4,294,967,295 as the
argument.
Calling Pascal Subprograms From FORTRAN
If you write a FORTRAN program that calls a Pascal subprogram (that is, a Pascal
function or procedure), you must observe the following rules:
You cannot bind FORTRAN routines compiled with ENV OLD in effect with Pascal
subprograms.
If the FORTRAN program does not declare the Pascal subprogram with a
GUARDIAN or CONSULT directive:
°
If the FORTRAN program is compiled with any EXTENDEDREF,
LARGECOMMON, or LARGEDATA directives, the called Pascal subprogram
must be compiled with the XMEM directive, so the Pascal subprogram will
expect the doubleword argument addresses that FORTRAN passes.
°
Otherwise, the called Pascal subprogram must be compiled with the NOXMEM
directive, so the Pascal procedure will expect the word-address arguments that
FORTRAN passes in this case.
If you call a Pascal subprogram that is EXTENSIBLE, FORTRAN cannot tell which
parameters are declared OPTIONAL, and assumes that all arguments are optional.