Used to simplify reference counting for a COM interface pointer.
with-temp-interface (var) interface-ptr form* => values
A variable which is bound to interface-ptr while the forms are evaluated.
A form which is evaluated to yield a COM interface pointer.
A form to be evaluated.
The values returned by the last form.
When the macro
with-temp-interface evaluates the forms, the variable var is bound to the value of interface-ptr. When control leaves the body (whether directly or due to a non-local exit),
release is called with this interface pointer.
This example invokes the COM method
GetDocumentation in the interface
ITypeInfo on an interface pointer which must be released after use.
(defun get-tinfo-member-documentation (disp tinfo
(get-type-info disp tinfo)
(call-com-interface (typeinfo i-type-info
LispWorks COM/Automation User Guide and Reference Manual - 23 Mar 2017