All interfaces implemented in a solution must be described in IDL files.
Only one interface can be declared in each IDL file.
The name of an IDL file must match the name of the interface that it describes.
An IDL file contains the following sections:
The only mandatory section.
The interface name must begin with an uppercase letter and must not contain an underscore (_).
A name declaration has the following format:
package <name of the described interface>
An interface name can be composite. In this case, it is used to generate a path to the IDL file, for example:
/* Module.idl located at: a/b/c/Module.idl */
package a.b.c.Module
A package import statement has the following format:
import <name of external package>
It enables you to enter the following elements of an external package into the scope of an IDL file: named constants and user-defined types, including structures and variant types.
An interface methods declaration has the following syntax:
interface {
<Declaration of methods>
}
The curly brackets contain declarations of methods that have the following syntax:
<Method name> (<arguments>)
The method name must not contain an underscore (_). It is recommended to begin the names of methods with an uppercase letter.
Arguments are divided into input (in
) and output (out
) and are separated with a comma. Example interface declaration:
interface {
/* Ping method declaration
Ping(in UInt32 value, out UInt32 result);
}
It is not recommended to use out
arguments to return codes of errors that occur when a request is being handled by the server entity. Instead, it is recommended to use specialized error
arguments. For more details, see Managing errors in IDL.
IDL supports single-line comments and multi-line C++-style comments.
Examples of IDL files
In the simplest case, an IDL description contains only a name and interface declaration:
Ping.idl
/* Ping is the interface name */
package Ping
/* Declaration of the interface methods */
interface {
/* Ping method declaration
Ping(in UInt32 value, out UInt32 result);
}
Example of a more complex IDL description:
Foo.idl
// Name declaration
package Foo
// Import statements
import Bar1
import Bar2
// Declaration of named constant
const UInt32 MaxStringSize = 1024;
// Declaration of synonym for user-defined type
typedef sequence <Char, MaxStringSize> String;
// Declaration of structure
struct BazInfo {
Char x;
array <String, 100> y;
sequence <sequence <UInt32, 100>, 200> y;
}
/* Declaration of interface methods
interface {
Baz(in BazInfo a, out UInt32 b);
}
Page top