This section describes how to load COM and generate any FLI definitions needed to use it, and how to build a COM DLL.
Before using any of the LispWorks COM API, it must be loaded by evaluating
(require "com")
COM definitions are typically described in one of two ways, either as IDL files, which allow the full range of COM definitions or as type libraries, which are generally only used for Automation. Before you can use any COM functionality in a Lisp application, you need to convert the COM definitions into Lisp FLI definitions and various supporting data structures. This corresponds to using midl.exe
or the MFC Class Wizard when writing C/C++ COM code.
To convert an IDL file, either compile it using the function midl or add it to a system definition with the option :type
:midl-file and compile and load the system.
Note: types like IDispatch
must declared before they are used, for this conversion to work.
Conversion of type libraries is covered in Using Automation.
Certain standard IDL files have already been converted to FLI definitions as part of the COM API modules. These are listed below and should not be converted again.
You can make a DLL with LispWorks by using deliver
(or save-image
) with the :dll-exports
keyword. The value of the
:dll-exports
keyword can include the keyword :com
, which exports (with appropriate definitions) the standard four symbols that a COM DLL needs:
DllGetClassObject
DllRegisterServer
DllUnregisterServer
DllCanUnloadNow
If no other symbols are exported, the value of :dll-exports
can be the keyword :com
, which means the same as the list (:com)
. See the
LispWorks Delivery User Guide
for more details.
You can use the function set-register-server-error-reporter to report when calls to DllRegisterServer
or DllUnregisterServer
fail.
LispWorks COM/Automation User Guide and Reference Manual - 23 Mar 2017