Technical data
Interlanguage Communication [9]
_fcdlen Conversion utility that extracts the byte length
from the Fortran character descriptor. Because
Fortran does not terminate character strings with a
null character, _fcdlen can be used to determine
the last character in the string.
_btol Conversion utility that converts a 0 to a Fortran
logical .FALSE. and a nonzero value to a Fortran
logical .TRUE.
_ltob Conversion utility that converts a Fortran logical
.FALSE. to a 0 and a Fortran logical .TRUE.
to a 1.
For more information on these utilities, see the description of the _cptofcd(3)
function in the UNICOS System Libraries Reference Manual.
9.3.5 Accessing Named Common from C and C++
The following example demonstrates how external C and C++ variables are
accessible in Fortran named common blocks. It shows a C or C++ C function
calling a Fortran subprogram, the associated Fortran subprogram, and the
associated input and output.
In this example, the C or C++ structure ST is accessed in the Fortran subprogram
as common block ST. The name of the structure and the Fortran common block
must match. Note that this requires that the structure name be uppercase. The C
and C++ C structure member names and the Fortran common block member
names do not have to match, as is shown in this example.
The following Cray Standard C main program calls the Fortran subprogram
FCTN:
S–2179–36 129










