RAD Studio
ContentsIndex
PreviousUpNext
SafeArrays

COM requires that arrays be passed via a special data type known as a SafeArray. You can create and destroy SafeArrays by calling special COM functions to do so, and all elements within a SafeArray must be valid automation-compatible types. The Delphi compiler has built-in knowledge of COM SafeArrays and automatically calls the COM API to create, copy, and destroy SafeArrays. 

In the Type Library Editor, a SafeArray must specify the type of its elements. For example, the following line from the text page declares a method with a parameter that is a SafeArray with an element type of Integer:

procedure HighLightLines(Lines: SafeArray of Integer);

 

HRESULT _stdcall HighlightLines(SAFEARRAY(long) Lines);

Note: Although you must specify the element type when declaring a SafeArray type in the Type Library Editor
, the declaration in the generated _TLB unit does not indicate the element type.

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!