Technical data

Interlanguage Communication [9]
INTEGER I
WRITE(6,100) STI, STD
100 FORMAT (IN FORTRAN: STI = , I5, , STD = , D25.20)
WRITE(6,200) (STA(I), I = 1,10)
200 FORMAT (IN FORTRAN: STA =, 10F4.1)
END
The previous Cray Standard C and Fortran examples are executed by the
following commands, and they produce the output shown:
$ cc -c c.c
$ ftn -c f.f
$ segldr c.o f.o
$ a.out
ST.i = 12345, ST.d = 1234567890.1234567890
In C: ST.a = 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0
IN FORTRAN: STI = 12345, STD = .12345678901234567889D+10
IN FORTRAN: STA = 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0
$
9.3.6 Accessing Blank Common from C or C++
Fortran includes the concept of a common block. A common block is an area of
memory that can be referenced by any program unit in a program. A named
common block has a name specified in a Fortran COMMON or TASKCOMMON
statement, along with the names of variables or arrays stored in the block. A
blank common block, sometimes referred to as blank common, is declared in the
same way, but without a name.
There is no way to access blank common from C or C++ similar to accessing a
named common block. However, you can write a simple Fortran function to
return the address of the first word in blank common to the C or C++ program
and then use that as a pointer value to access blank common.
The following example shows how Fortran blank common can be accessed
using C or C++ source code:
S217936 131