Figure 1: The SAFEARRAY data structure

typedef struct tagSAFEARRAYBOUND {
   unsigned long cElements;
   long lLbound;
} SAFEARRAYBOUND;

typedef struct FARSTRUCT tagSAFEARRAY {
    unsigned short cDims;             // Count of dimensions in
                                      // this array

    unsigned short fFeatures;         // Flags used by the 
                                      // SafeArray routines 

    unsigned long cbElements;         // Size of an element 
                                      // of the array. Does not 
                                      // include size of
                                      // pointed-to data.

    unsigned long cLocks;             // Number of times the 
                                      // array has been locked 
                                      // without corresponding
                                      // unlock

    void HUGEP* pvData;               // Pointer to the data

    SAFEARRAYBOUND rgsabound[1];      // One bound for each
                                      // dimension
} SAFEARRAY;