All Manuals > LispWorks COM/Automation User Guide and Reference Manual > 2 COM Reference Entries

NextPrevUpTopContentsIndex

with-temp-interface

Macro
Summary

Used to simplify reference counting for a COM interface pointer.

Package

com

Signature

with-temp-interface (var) interface-ptr form* => values

Arguments

var

A variable which is bound to interface-ptr while the forms are evaluated.

interface-ptr

A form which is evaluated to yield a COM interface pointer.

form

A form to be evaluated.

Values

values

The values returned by the last form.

Description

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.

Example

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
                                            member-id)
  (with-temp-interface (typeinfo)
      (get-type-info disp tinfo)
    (call-com-interface (typeinfo i-type-info
                                  get-documentation)
                        member-id)))
See also

release
with-query-interface


LispWorks COM/Automation User Guide and Reference Manual - 14 Feb 2015

NextPrevUpTopContentsIndex