PreviousNext

Writing the Interface Definition File

The .idl file is where the set of remote operations that constitute the interface are defined. The .idl file defines and characterizes the interfaces to the server implementations of the remote operations (which you write, in C source code, then compile and link to the stub code output by the IDL compiler). Thus, an .idl file's contents is like a set of network prototypes for a set of operations. The IDL definitions in the interface definition file determine not only how the operations "look" to client and server (that is, the operations' call signatures, parameter types, and so on), but also what the data looks like when it is transmitted back and forth between clients and servers in a distributed application.

An interface definition file consists of the following two basic components:

· An interface header
An interface header contains an interface UUID, interface version numbers, and an interface name. An interface name is an easy-to-read local name that is not guaranteed to be unique; it is merely a convenience. It is helpful if the interface name reflects the nature or purpose of the interface.

· An interface body
An interface body declares any application-specific data types and constants, and contains directives for including data types and constants from other interfaces. The interface body also contains the operation declaration of each remote procedure to be accessed through the interface. An operation declaration identifies the parameters of a procedure in terms of their data types, access method, and call order, and declares the data type of the return value (if any).

The skeletal interface definition produced by the uuidgen utility provides an interface header that contains the newly generated UUID for the interface, a version number, and a dummy string INTERFACENAME. Replace this dummy string with the name of your interface, then add any additional interface header attributes your application requires. (See the OSF DCE Application Development Guide - Core Components for a complete description of interface header attributes).

The skeletal interface definition file also provides an interface body, which consists solely of { }, that is, an empty pair of braces. You fill in the space between the braces with your RPC interface's import, constant, type, and operation declarations, written in IDL. The OSF DCE Application Development Guide - Core Components explains this process in more detail. In addition, the same volume for a complete description of the IDL syntax for specifying import, constant, type, and operation declarations.

Note that a server can implement more than one interface. In this case, you define each interface in a separate .idl file and compile it separately with the IDL compiler. You then link the implemented interface operations in various source code files with the IDL output.