




 
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_isattribute 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 
stringattribute, 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
VARIANTwith 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
:foreignand 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
SAFEARRAYor a Lisp array. In the latter case, a new
SAFEARRAYis 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
nilor
taccording 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





