In this section we declare the IDL interface that the Hello World client and server will communicate across. This is the usual first step in developing a CORBA-based application in Dylan.
We declare the interface in a single file that must have the extension .idl. Recall that when creating the client and server projects, we unchecked the "Use existing IDL file" option on the second wizard page. Instead of letting the client and server projects refer to an existing IDL file, the wizard created a dummy file into which we can write our IDL interface.
Both the client and server projects point to the dummy IDL file via a file called my-hello-world.spec. Spec files, or Functional Developer Tool Specification files, contain special information for building projects. The file my-hello-world.spec is part of each project's list of sources, but it is a different file in each project.
my-hello-world.spec in the Sources page of either project window.
The client project's spec file looks like this:
Origin: OMG-IDL Idl-File: ..\my-hello-world.idl Stubs: yes
The server project's spec file looks like this:
Origin: OMG-IDL Idl-File: ..\my-hello-world.idl Skeletons: yes
Both spec files contain an Idl-File: keyword statement saying that the file my-hello-world.idl, which is in the parent folder of both My-Hello-World-Client and My-Hello-World-Server, should be compiled along with each project's Dylan sources. We can ignore the other details for the moment.
my-hello-world.idl.
my-hello-world.idl and click Open.
The dummy IDL file initially contains only a comment and no IDL declarations. We must write these ourselves. For Hello World, the IDL is simply:
interface world {
string hello();
};
This IDL declaration says there are CORBA objects of a kind called world, and that there is an operation called hello on world objects that takes no arguments and returns a string. Servers implement world and clients call hello on instances of world.
my-hello-world.idl file.
my-hello-world.idl with File > Save.
Now we have written the IDL, we can run the IDL compiler over it to produce stub, skeleton, and protocol code for the client and server parts of the application.