Rather than using make to directly instantiate the COM object, a local server should create a class factory. The class <class-factory> is provided as a convenient way to do this. For example:
make(<class-factory>,
class: <my-dispatch-object>,
typeinfo: make(<disp-type-info>, ...),
clsid: make-GUID(...))
This code creates and registers a class factory so that the designated dispinterface class is instantiated when a client tries to invoke a server for the designated Class ID. You can also provide any initialization keywords accepted by the class being instantiated, and the following class factory options:
server-context: $CLSCTX-LOCAL-SERVER.
connection-flags: $REGCLS-SINGLEUSE.
Before your server application terminates, it must call the function revoke-registration, page 227, on the class factory.
As a convenience, making a <class-factory> and calling revoke-registration can be combined by using the macro with-class-factory like this:
with-class-factory (class: <my-dispatch-object>,
typeinfo: make(<disp-type-info>, ...),
clsid: make-GUID(...) )
... // body of application
end with-class-factory;
When using a <coclass-type-info>, it contains everything the class factory needs, so the factory can be created simply by doing:
let factory = make-object-factory(my-coclass-type-info);