IDL

All interfaces implemented in a solution must be described in IDL files. Each IDL file consists of a package of declarations in the IDL language.

An IDL file contains the following sections:

  1. Package name.

    The only mandatory section.

    A package name declaration has the following format:

    package <name of the described package>

    A package 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

  2. Import external packages.

    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.

  3. Declaring structures, variant types, named constants, and synonyms.
  4. Declaration of interfaces.

    An interface declaration has the following syntax:

    interface <interface name> {

    <Declaration of methods>

    }

    The curly brackets contain declarations of methods that have the following syntax:

    <Method name> (<arguments>)

    Arguments are divided into input (in) and output (out) and are separated with a comma. Example declaration of the IPing interface:

    interface IPing {

    /* Ping method declaration

    Ping(in UInt32 value, out UInt32 result);

    }

IDL supports single-line comments and multi-line C++-style comments.

Examples of IDL files

In the simplest case, an IDL description contains only the package name and interface declaration:

ping.idl

/* ping – package name */

package ping

/* IPing interface declaration */

interface IPing {

/* Ping method declaration

Ping(in UInt32 value, out UInt32 result);

}

Example of a more complex IDL description:

Foo.idl

// Package name declaration

package Foo

// Package 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 interfaces

interface IFoo {

foo (in UInt32 a);

bar (in UInt32 a, out UInt32 b1, out UInt8 b2);

}

interface IBaz {

baz (in BazInfo a, out UInt32 b);

}

Page top