SafeArrayCreateVector

SAFEARRAY SafeArrayCreateVector( 
  VARTYPE  vt,             
  long  lLbound,           
  unsigned int  cElements  
);
 

Creates a one-dimensional array whose lower bound is always zero. A safe array created with SafeArrayCreateVector is a fixed size, so the constant FADF_FIXEDSIZE is always set.

Parameters

vt
The base type of the array (the VARTYPE of each element of the array). The VARTYPE is restricted to a subset of the variant types. Neither the VT_ARRAY nor the VT_BYREF flag can be set. VT_EMPTY and VT_NULL are not valid base types for the array. All other types are legal.
lLbound
The lower bound for the array. Can be negative.
cElements
The number of elements in the array.

Return Value

Points to the array descriptor, or Null if the array could not be created.

Comments

SafeArrayCreateVector allocates a single block of memory containing a SAFEARRAY structure for a single-dimension array (24 bytes), immediately followed by the array data. All of the existing safe array functions work correctly for safe arrays that are allocated with SafeArrayCreateVector.

A SafeArrayCreateVector is allocated as a single block of memory. Both the SafeArray descriptor and the array data block are allocated contiguously in one allocation, which speeds up array allocation. However, a user can allocate the descriptor and data area separately using the SafeArrayAllocDescriptor and SafeArrayAllocData calls.