Now we create a project for the client-side stubs of the encryption interface.
C:\Program Files\Functional Objects\Functional Developer\Examples.
Documentation\RotNExample subfolder and choose the RotNExample.tlb file.
We are now at the Use Libraries page. We are only defining the stubs for the client, so we do not need any unusual libraries.
Note that the "OLE Automation" option on the "OLE Automation support" page is automatically selected. That is what we want.
We are now at the final page of the New Project wizard.
As with the server stubs project, we have to build this project to make the type library tool run.
As before, files are added to the project. The type-library-module.dylan file serves the same purpose as with the server stubs. The difference is that stubs.dylan contains different code. It defines a dispatch-client class for the IRotNExample interface:
/* Dispatch interface: IRotNExample version 0.0
* GUID: {822ED42A-3EB1-11D2-A3CA-0060B0572A7F}
* Description: An example interface for Functional Developer's
Getting Started manual.
*/
define dispatch-client <IRotNExample>
uuid "{822ED42A-3EB1-11D2-A3CA-0060B0572A7F}";
property IRotNExample/key ::
type-union(<integer>, <machine-word>), name: "key",
disp-id: 12288;
function IRotNExample/encrypt (arg-pre :: <string>) =>
(arg-result :: <string>), name: "encrypt", disp-id: 24576;
function IRotNExample/decrypt (arg-pre :: <string>) =>
(arg-result :: <string>), name: "decrypt", disp-id: 24577;
end dispatch-client <IRotNExample>;
This defines a class <IRotNExample> which allows a client to use the described interface.
There is also generated code corresponding to the COM class RotNExample from the type library:
/* COM class: RotNExample version 0.0
* GUID: {C44502DB-3EB1-11D2-A3CA-0060B0572A7F}
* Description: Implementation of IRotNExample.
*/
define constant $RotNExample-class-id =
as(<REFCLSID>, "{C44502DB-3EB1-11D2-A3CA-0060B0572A7F}");
define function make-RotNExample ()
=> (default-interface :: <IRotNExample>)
let default-interface = make(<IRotNExample>,
class-id: $RotNExample-class-id);
values(default-interface)
end function make-RotNExample;
This function creates an instance of the RotNExample COM class, and returns its default (and only) interface.