System.Variants.VarArrayLock

From Appmethod Libraries
Jump to: navigation, search

Object Pascal

function VarArrayLock(const A: Variant): Pointer;

C++

extern DELPHI_PACKAGE void * __fastcall VarArrayLock(const System::Variant &A);

Properties

Type Visibility Source Unit Parent
function public
System.Variants.pas
System.Variants.hpp
System.Variants System.Variants

Description

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

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.

See Also


Code Examples