RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
Variants.VarArrayLock Function

Locks a variant array and returns a pointer to the data.

Pascal
function VarArrayLock(const A: Variant): Pointer;
C++
void * VarArrayLock(const Variant A);

VarArrayLock locks the given variant array and returns a pointer to the data stored in the array. While locked, a variant array can not be resized and any calls to VarArrayRedim will fail. Once locked, a variant array must later be unlocked using VarArrayUnlock. An EVariantInvalidArgError exception is raise if the variant given by A is not an array. 

The pointer returned by VarArrayLock points to an array of elements in which the leftmost dimension increases first. In other words, the dimensions of the returned array pointer are reversed from the dimensions of the variant array. 

Once it is verified that a variant array has the correct bounds and dimensions, VarArrayLock can be used to gain direct access to the array data, which results in improved performance. 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!