78
IRIS WORKSTATION GUIDE
Arrays of character variables are treated by FORTRAN as simple byte-arrays,
with no alignment of elements. If the array sarray() is declared as
character*(*) sarray()
the length of the individual elements will be determined by the length passed
at run time. This length is important for doing indexing into the array.
mkf2c and mkc2f have special constructs for dealing with the lengths of FORTRAN
character variables.
Parameter Reductions
mkf2c and mkc2f reduce each parameter to one of the following simple objects:
• 32-bit value. When C is calling FORTRAN, mkc2f will pass
FORTRAN the address of the data value on the stack. When
FORTRAN is calling C, mkf2c will use the address on the stack to
retrieve a 32-bit data value. This data value is passed to C. The
C types int, float, double and long are reduced to 32-bit values. Any
parameter whose type is unspecified is assumed to be int.
• 64-bit value. The quantity is loaded indirectly from the address on
the stack and passed when calling C from FORTRAN. The address
of the value on the stack is passed when calling FORTRAN from C.
Only the C type long float is reduced to a 64-bit data value.
• 16-bit value. When calling FORTRAN from C, the address of
the value found on the stack is passed. When calling C from
FORTRAN, a 16-bit value is loaded using the address on the stack.
The value is either extended or masked depending on whether its
type in the function parameter list is specified as signed or unsigned,
and passed to C. The C type short is reduced to a 16-bit value.
• 8-bit data. The char type in C corresponds to the character*1 type in
FORTRAN 77, and the parameter is altered accordingly. There is
no way to have a small integer value in FORTRAN 77 (i.e. integer*1)
passed as a value to C. A pointer to the value can be passed by
declaring the parameter as int *.
• character string. When calling C from FORTRAN, a COPY is made of
the string, is null-terminated, and passed as a character pointer to
C. Any modifications that C makes to the string will not affect
FORTRAN. When calling FORTRAN from C, the length of the
string. (as determined by strlen) and its address is passed to
FORTRAN. Any modifications that FORTRAN makes to the string
will affect C. The C type char * is reduced to this type.
• character array. When calling C from FORTRAN, the address of the
character variable is passed. This character array can be modified
by C. It is not guaranteed to be null-terminated. The length of the
Appendix D:
Version 1.0
Need help?
Do you have a question about the IRIS Workstation and is the answer not in the manual?