Compartir a través de


ODL File Syntax

The general syntax for an .ODL file is as follows:

[attributes] library libname {definitions};

The attributes associate characteristics with the library, such as its Help file and universally unique identifier (UUID). Attributes must be enclosed in square brackets.

The definitions consist of the descriptions of the imported libraries, data types, modules, interfaces, dispinterfaces, and coclasses that are part of the type library. Braces ({}) must surround the definitions.

The following table summarizes the elements that can appear in definitions. Each element is described in more detail in the section ODL Reference.

Purpose Library element Description
Allows references to other type libraries.
importlib (lib1)
Specifies an external type library that contains definitions that are referenced in this type library.
Declares data types used by the objects in this type library.
typedef[attributes]aliasname
An alias declared using C syntax. Must have at least one attribute to be included in the type library.
typedef [attributes] enum
An enumeration declared using the C keywordstypedef and enum.
typedef [attributes] struct
A structure declared using the C keywordstypedefand struct.
typedef [attributes] union
A union declared using the C keywordstypedefand union.
Describes functions that enable querying the DLL.
[attributes] module
Constants and general data functions whose actions are not restricted to any specified class of objects.
Describes interfaces.
[attributes] dispinterface
An interface describing the methods and properties for an object that must be accessed through IDispatch::Invoke.
[attributes] interface
An interface describing the methods and properties for an object that can be accessed through VTBL entries or possibly also through IDispatch::Invoke.
Describes OLE classes.
[attributes] coclass
Specifies a top-level object with all of its interfaces and dispinterfaces.

In the library description, modules, interfaces, dispinterfaces, and coclasses follow the same general syntax:

[attributes] elementname typename {
   memberdescriptions
};

The attributesset characteristics for the element. The elementname is a keyword that indicates the kind of item (module, interface, dispinterface, or coclass), and the typenamedefines the name of the item. The memberdescriptions define the members (constants, functions, properties, and methods) of each element.

Aliases, enumerations, unions, and structures have the following syntax:

typedef [typeattributes] typekind typename {
   memberdescriptions
};

Remarks

For these types, the attributes follow the typedefkeyword, and the typekind indicates the data type (enum, union, or struct). For details, see Attribute Descriptions.

Note

The square brackets ([ ]) and braces ({ }) in these descriptions are part of the syntax, and are not descriptive symbols. The semicolon after the closing brace (}) that terminates the library definition (and all other type definitions) is optional.

Type Libraries and the Object Description Language