The define-com-method
macro is used to define a COM method for a particular implementation class.
define-com-method method-spec (class-spec arg-spec*) form*
method-spec ::= method-name | (interface-name method-name)
Specifies the method to be defined.
A symbol naming the method to define.
A symbol naming the interface of the method to define. This is only required if the implementation class class-name has more than one method with the given method-name.
Specifies the implementation class and variables bound to the object with in the forms.
A symbol which will be bound to the COM object whose method is being invoked.
A symbol naming the COM implementation class for which this method is defined.
A optional symbol which will be bound to the COM interface pointer whose method is being invoked. Usually this is not needed unless the interface pointer is being passed to some other function in the implementation.
Describes one of the method's arguments.
A symbol which will be bound to that argument's value while the forms are evaluated.
Specifies the direction of the argument, either :in
, :out
or :in-out
If specified, it must match the definition of the interface. The default is taken from the definition of the interface.
Specifies how the argument will be converted to a Lisp value. It can be either :lisp
or :foreign
, the default is :lisp
.
Forms which implement the method. The value of the final form is returned as the result of the method.
The macro define-com-method
defines a COM method that implements the method method-name for the COM implementation class class-name. The extended method-spec syntax is required if class-name implements more than one interface with a method called method-name (analogous to the C++ syntax InterfaceName::MethodName
).
The symbol this is bound to the instance of the COM implementation class on which the method is being invoked. The symbol this is also defined as a local macro (as if by with-com-object), which allows the body to invoke other methods on the instance.
If present, the symbol interface is bound to the interface pointer on which the method is being invoked.
Each foreign argument is converted to a Lisp argument as specified by the pass-style. See Data conversion in define-com-method for details.
If an error is to be returned from an Automation method, the function set-error-info can be used to provide more details to the caller.
(define-com-method (i-robot rotate)
((this i-robot-impl)
(axis :in)
(angle-delta :in))
(let ((joint (find-joint axis)))
(rotate-joint joint))
S_OK)
LispWorks COM/Automation User Guide and Reference Manual - 14 Feb 2015