In parameters are passed as positional arguments in the order they are specified and do not affect the return values.
string
attribute can be passed either as a foreign pointer or as a Lisp string (converted to a foreign string with dynamic extent for the duration of the call).
size_is
attribute can be passed either as a foreign pointer or, if the element type is not a foreign aggregate type, as a Lisp array of the appropriate rank (converted to a foreign array with dynamic extent for the duration of the call).import "unknwn.idl";
[ object,
uuid(E37A70A0-EFC9-11D5-BF02-000347024BE1)
]
interface IArgumentExamples : IUnknown
{
typedef [string] char *argString;
HRESULT inMethod([in] int inInt,
[in] argString inString,
[in] int inArraySize,
[in, size_is(inArraySize)] int *inArray);
}
the method
in-method
can be called with Lisp objects like this:
(let ((array #(7 6)))
(call-com-interface (arg-example i-argument-examples
in-method)
42
"the answer"
(length array)
array))
or with foreign pointers like this:
(fli:with-dynamic-foreign-objects ()
(let* ((farray-size 2)
(farray (fli:allocate-dynamic-foreign-object
:type :int
:nelems farray-size
:initial-contents '(7 6))))
(fli:with-foreign-string (fstring elt-count byte-count)
"the answer"
(declare (ignore elt-count byte-count))
(call-com-interface (arg-example i-argument-examples
in-method)
42
fstring
farray-size
farray))))
Note that the
int
arguments are always passed as Lisp
integer
because
int
is a primitive type.