Navigation: Language Reference > 3 - Variable Declarations > Data Types >VARIANT (OLE API VARIANT) | |
label | VARIANT | [,DIM( )] , [,NAME( )] [,EXTERNAL] [,DLL] |
[,STATIC] [,THREAD] [,AUTO] [,PRIVATE] [,PROTECTED] |
VARIANT | An OLE API VARIANT. The ANY data type is preferable if the program does not use OLE API functions. |
DIM | Dimension the variable as an array. |
NAME | Specify an alternate, “external” name for the field. |
EXTERNAL | Specify the variable is defined, and its memory is allocated, in an external library. Not valid within FILE, QUEUE, or GROUP declarations. |
DLL | Specify the variable is defined in a .DLL. This is required in addition to the EXTERNAL attribute. |
STATIC | Specify the variable's memory is permanently allocated. |
THREAD | Specify memory for the variable is allocated once for each execution thread. Also implicitly adds the STATIC attribute on Procedure Local data. |
AUTO | Ignored by the compiler but does not produce an error |
PRIVATE | Specify the variable is not visible outside the module containing the CLASS methods. Valid only in a CLASS. |
PROTECTED | Specify the variable is not visible outside base CLASS and derived CLASS methods. Valid only in a CLASS. |
The OLE API VARIANT iis equivalent to the OLE API Variant type. A VARIANT can be assigned any data type, and can be a field within a QUEUE. The compiler ignores the AUTO attribute for variables of VARIANT type. The value of a VARIANT can reference another VARIANT if its type has the VT_BYREF flag. Such lists can be of any depth. The Clarion RTL handles only one level of references. The Clarion RTL sets the VT_BYREF flag to values of VARIANTs only on a reference assignment, for example:
V VARIANT
X <;some type>
CODE
V &= X !the RTL sets the VT_BYREF flag
The VARIANT type can be used in the left side of reference assignments. The SIZE function returns 16 regardless of the contents of the VARIANT.
Example:
V1 VARIANT | !declare VARIANT |
V2 VARIANT,DIM(2) | !declare VARIANT array |
V3 VARIANT,STATIC | !Static memory allocation |
V4 VARIANT,AUTO | !AUTO is ignored by the compiler |
V5 VARIANT,THREAD | !set THREAD attribute |
V6 VARIANT,NAME('DT') | !external name |
see also: