the name of the file you want to include. All text in file is prepended to each of the source files specified on the command line, before being passed to the compiler.
See “File handling” (page 120) for another example of a program that uses the $HP$ ALIAS directive. The HP Fortran Programmer's Reference fully describes the %VALand
Arrays
There are two differences between HP Fortran and C to consider when passing arrays from Fortran to C:
•In HP Fortran, array subscripts start by default at 1, whereas in C they always start at 0
•In HP Fortran,
The difference in
The difference in the way
Figure
Memory layout of a two-dimensional array in Fortran and C
Figure 3 Memory layout of a
To compensate for this difference, the dimensions of the array in either the C or Fortran code should be declared in the reverse order of the other. For example, if the array is declared in Fortran as follows:
INTEGER, DIMENSION(3,6) :: my_array
then the array should be declared in C as follows:
int my_array[6][3];
You can change the array declaration in either language, whichever is more convenient. The important point is that, to be conformable, the dimensions must be in reverse order.
Below is an example for a
REAL, DIMENSION(2,3,4) :: x
Below is the same declaration as declared in C.
int x[4][3][2];
116 Calling C routines from HP Fortran