next up previous contents
Next: Calling Methods From FORTRAN Up: FORTRAN 90 Bindings Previous: Introduction   Contents


Basic Types


Table 9.1: SIDL to FORTRAN 90 type mapping
SIDL TYPE FORTRAN 90 TYPE
int INTEGER (SELECTED_INT_KIND(9))
long INTEGER (SELECTED_INT_KIND(18))
float REAL (SELECTED_REAL_KIND(6,37))
double REAL (SELECTED_REAL_KIND(15, 307))
bool LOGICAL
char CHARACTER (LEN=1)
string CHARACTER (LEN=*)
fcomplex COMPLEX (SELECTED_REAL_KIND(6, 37))
dcomplex COMPLEX (SELECTED_REAL_KIND(15, 307))
enum INTEGER (SELECTED_INT_KIND(9))
opaque INTEGER (SELECTED_INT_KIND(18))

The mapping for simple SIDL types to FORTRAN 90 is given in Table 9.1. For opaque pointers, the equivalent of a SIDL double is used. That is, the intermediate object reference assumes a 64-bit integer is used to enable portability between systems with a 32 bit address space and those with a 64 bit address space. On a 32 bit system, the upper 32 bits of these quantities are ignored. Systems with more than 64-bit pointers aren't currently supported.

For interfaces, classes and arrays, there is a derived type that holds an opaque pointer. For each interface and class, there are two modules created. In the first module, the derived type for the object and array are defined. In the second, the methods for the object/interface and arrays of the object/interface are defined. Clients of a class or interface, typically use the module containing the methods, and it in turn uses the module containing the types.

Generally, clients should treat opaque, interface, class and array values as black boxes. However, there is one value that is special. A value of zero for any of these quantities indicates that the value does not refer to an object. Zero is the equivalent of NULL. Any nonzero value is or should be a valid object reference. The method module provides functions to test whether an interface, class or array value is_null or is not_null. There is also a subroutine to initialize the value to set_null. Clients should generally initialize new interface or class values to NULL.

The SIDL string type mapping is currently identical to that of the FORTRAN 77 mapping. That is, all FORTRAN 90 strings have a limited fixed size. When implementing a subroutine with an out parameter, the size of the string is limited to 1024 characters.

Enumerated types are just integer values. The integer parameters are defined in a module.


next up previous contents
Next: Calling Methods From FORTRAN Up: FORTRAN 90 Bindings Previous: Introduction   Contents


babel-0.8.6
users_guide Last Modified 2003-07-09

http://www.llnl.gov/CASC/components
components@llnl.gov