ARRoffset
Synopsis
INTEGER FUNCTION ARRFoffset(array_ptr,
. basevec,
. type)
INTEGER array_ptr
DIMENSION basevec(1)Description
This routine enables FORTRAN programmers to access memory locations specified by a pointer in a portable manner.On 64-bit platforms, the first argument to ARRFoffset and the first argument to ARRFoffset are actually an INTEGER*8.Arguments
array_ptrThe address of a memory area allocated with ARRFalloc or returned by ARRFretptr or by one of the get_array access routines described below (expressed as an integer).
basevectypetypeA code for the data type of the local array basevec , expressed as an integer. It is used to compute the correct addressing offset according to the size of the elements of the local array. The meaningful codes predefined in the include file omf.inc are:
Code basevec(1) data type DTYPE_INT INTEGER DTYPE_FLOAT REAL DTYPE_DOUBLE DOUBLE PRECISION
Returned value
The addressing offset of an allocated memory area with respect to the first element of basevec .Examples
C Allocate a memory area and fill some values in#include <avs/omf.inc> INTEGER iaddr, offset, sizeC On 64-bit platforms, iaddr should be INTEGER*8 REAL base(1) ... size = 2000 iaddr = ARRFalloc(0,DTYPE_FLOAT,size,0) IF (iaddr .EQ. 0) PRINT*,'Error allocating memory area' offset = ARRFoffset(iaddr,base,DTYPE_FLOAT)C DO 100 i=1,size base(offset+i) = FLOAT(i) 100 CONTINUESee Also