next up previous contents
Next: 8 Function Pointers Up: IMPL_repdoc Previous: 6 Array Sharing   Contents

Subsections

7 Pointer Size

The ESMF must support both 32 and 64 bit architectures. Since deep classes are represented on the F90 side by handles, and since we are doing some manual manipulations on pointers, we need to take care to make sure that our classes support both types of pointers.

7.1 C/C++ Implementation

In our C/C++ code we let the compiler decide on the pointer size by making the argument a pointer:

  void FTN(c_alpine_create)(climber **ths);

The C/C++ code dereferences this pointer to pointer and uses the result. On a 32 bit platform the result will be 4 bytes. On a 64 bit platform it will be 8 bytes. The memory that the dereference accesses is actually our F90 type:

	type climberPtr
	sequence
	integer(r8) this
	end type

In this simple example we have made sure that we have at least 8 bytes of memory available so the pointer may be stored. In the more complex examples we have the build process specify the pointer size, and our type looks like:

!  In config header file
#define POINTER_SIZE 8

        type decomp
        character, dimension(POINTER_SIZE) :: this
        end type



esmf_support@list.woc.noaa.gov