LispWorks COM/Automation User Guide and Reference Manual > 4 Automation Reference Entries

NextPrevUpTopContentsIndex

set-variant

Function
Summary

Sets the fields in a VARIANT pointer.

Package

com

Signature

set-variant variant type &optional value

Arguments

variant

A foreign pointer to an object of type VARIANT .

type

A keyword specifying the type of value.

value

The value to store in variant .

Description

The function set-variant can be used to set the type and value of a VARIANT object. It is useful if the default type provided by the automatic conversion for VARIANT return values is incorrect. The value of meaning of type is an specified below

 

Value of type

VT code used

Expected type of value

nil

dynamic

any suitable

:empty

VT_EMPTY

ignored

:null

VT_NULL

ignored

:short

VT_I2

integer

:long

VT_I4

integer

:float

VT_R4

single-float

:double

VT_R8

double-float

:cy

VT_CY

 

:date

VT_DATE

 

:bstr

VT_BSTR

string

:dispatch

VT_DISPATCH

FLI pointer

:error

VT_ERROR

ignored

:bool

VT_BOOL

nil or non nil

:variant

VT_VARIANT

FLI pointer

:unknown

VT_UNKNOWN

FLI pointer

:decimal

VT_DECIMAL

 

(:unsigned :char)

VT_UI1

integer

(:array . type )

VT_BYREF +
VT
code for type

array

:array
or (:array array )
or (:array . types )

VT_ARRAY + VT_VARIANT

array

(:pointer type2 )

VT_BYREF +
VT
code for type2

FLI pointer

If type is nil then the actual VT code is chosen dynamically according to the Lisp type of value (see Automation types, VT codes and their corresponding Lisp types).

If type is a cons of the form (:array . type ) for some keyword type , then variant is set to contain an array of objects of type . Each element of value is expected to be suitable for conversion to type .

If type is :array or another list starting with :array then variant is set to contain an array of VARIANT objects with the same dimensions as value . Each element of value is converted as if by calling set-variant with a type chosen as follows:

Examples
(set-variant v :null) (set-variant v :short 10) (set-variant v '(:pointer :short) ptr) (set-variant v '(:array :short :int) #(1 2))
See also

define-com-method


LispWorks COM/Automation User Guide and Reference Manual - 22 Dec 2009

NextPrevUpTopContentsIndex