LispWorks COM/Automation User Guide and Reference Manual > 3 Using Automation > 3.4 Implementing Automation interfaces in Lisp


3.4.1 A complete implementation of an Automation server

In the case where you are designing an set of COM interfaces and implementing a server to support them, you need to make a complete implementation in Lisp. This allows several Automation interfaces to be implemented by a single class and also supports dual interfaces.

The implementation defines an appropriate class, inheriting from the class standard-i-dispatch to obtain an implementation of the COM interface i-dispatch. This implementation of i-dispatch will automatically invoke the appropriate COM method.

For dual interfaces, the methods should be defined in the same way as described for COM interfaces in Implementing COM interfaces in Lisp.

For dispinterfaces , the methods should be implemented using the macro define-dispinterface-method or by a specialized method of the generic function com-object-dispinterface-invoke.

To implement an Automation interface in Lisp with standard-i-dispatch, you need the following:

  1. A type library for the component, converted to Lisp as specified in Including Automation in a Lisp application.
  2. A COM object class defined with define-automation-component or define-automation-collection, specifying the coclass or interface(s) to implement.
  3. Implementations of the methods using define-com-method, define-dispinterface-method or com-object-dispinterface-invoke.
  4. For an out-of-process Automation component, registration code which calls register-server and unregister-server, typically in response to the command line arguments /RegServer and /UnRegServer .
  5. Initialization code which calls co-initialize and start-factories in a thread that will be processing Windows messages (for instance a CAPI thread).

LispWorks COM/Automation User Guide and Reference Manual - 22 Dec 2009