Next Previous Up Top Contents Index

2 Quick Start Tutorial

2.4 Defining the interface

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.

1. Double-click on my-hello-world.spec in the Sources page of either project window.
The spec file opens in an editor 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.

2. Choose File > Open... in either project window, and navigate to the project's parent folder containing my-hello-world.idl.
Hint: clicking the General tab in either the client or server project window shows where the project resides on your machine.
3. Select my-hello-world.idl and click Open.
The dummy IDL file opens in an editor window.

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.

4. Enter the IDL declaration above into the my-hello-world.idl file.
5. Save 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.

2.4.1 - Generating stub, skeleton, protocol code from IDL
2.4.2 - A browsing detour

Developing Component Software with CORBA - 26 May 1999

Next Previous Up Top Contents Index