1.8.6.4 In-out parameters
For
in-out
parameters:
-
A parameter whose type is an array type or a pointer type with a
size_is
attribute will be converted to a Lisp array of the appropriate size allocated for the dynamic extent of the body forms. The initial contents of the Lisp array will be taken from the foreign array which was passed by the caller. After the body has been evaluated, the contents of the Lisp array will be copied back into the foreign array.
-
For a parameter with the
string
attribute, the parameter will be the converted to a Lisp string. To return a different string, the parameter should be set to another (non
eq
) Lisp string, which will cause the original foreign string to be freed with
CoTaskMemFree()
and a new foreign string allocated with
CoTaskMemAlloc()
. The initial string should not be destructively modified by the body.
-
For a parameter of COM type
BSTR*
, the parameter will be the converted to a Lisp string. To return a different string, the parameter should be set to another (non
eq
) Lisp string, which will cause the original foreign string to be freed with
SysFreeString()
and a new foreign string allocated with
SysAllocString()
.
-
For parameters of COM type
VARIANT*
, the parameter will be converted to a Lisp object (see Automation types, VT codes and their corresponding Lisp types). To return a different value, the parameter should be set to another (non
eq
) value, which will be placed back into the
VARIANT
with the VT code being set according to the Lisp type (see Automation types, VT codes and their corresponding Lisp types). If exact control of the VT code is required, use the
pass-style
:foreign
and the function set-variant.
-
For parameters of COM type
SAFEARRAY(
type
)*
, the parameter will be converted to a Lisp array. The elements of type
type
are converted as in Automation types, VT codes and their corresponding Lisp types. To return a different value, the parameter should be set to another (non
eq
) value, which can be either a foreign pointer to an appropriate
SAFEARRAY
or a Lisp array. In the latter case, a new
SAFEARRAY
is created which contains the elements of the Lisp array converted as in Automation types, VT codes and their corresponding Lisp types.
-
For parameter of COM type
VARIANT_BOOL*
, the parameter will be
nil
or
t
according to the initial value (zero or non zero). To return a different value, set the parameter to a new value, which can be a generalized boolean.
LispWorks COM/Automation User Guide and Reference Manual - 17 Jul 2006