8 Calling C routines from HP Fortran
This section describes language differences between C and HP Fortran that affect calling C routines from an HP Fortran program. This includes the following topics:
•Data types Calling C routines from HP Fortran 182 Chapter 8
•
•Case sensitivity
•Arrays
•C strings
•File handling
•Sharing data
Data types
Table
Table 32 Data type correspondence for HP Fortran and C
HP Fortran | C |
|
|
CHARACTER | char (array of) |
|
|
Hollerith (synonymous with CHARACTER) | char(array of) |
|
|
BYTE, LOGICAL(KIND=1), INTEGER(KIND=1) | char |
|
|
LOGICAL(KIND=2) | short |
|
|
INTEGER(KIND=2) | short |
|
|
LOGICAL, LOGICAL(KIND=4) | longor int |
|
|
INTEGER, INTEGER(KIND=4) | longor int |
|
|
INTEGER(KIND=8) | long long |
|
|
REAL, REAL(KIND=4) | float |
|
|
DOUBLE PRECISION, REAL(KIND=8) | double |
|
|
REAL(KIND=16) | long double |
|
|
COMPLEX, COMPLEX(KIND=4) | struct |
|
|
DOUBLE COMPLEX, COMPLEX(KIND=8) | struct |
|
|
derived type | struct |
|
|
Using the +DA2.0Woption to compile HP Fortran programs in
Table
110 Calling C routines from HP Fortran