All Manuals > 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, either use automation-server-main or have registration code which calls register-server and unregister-server, typically after checking the result of automation-server-command-line-action or explicitly checking the command line for arguments /RegServer and /UnRegServer .
  5. Initialization code which either calls automation-server-top-loop or automation-server-main, or 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 - 19 Dec 2011