The IDL Interface Header

The interface header specifies information about the interface as a whole. It must contain the uuid or local attribute and, whichever one you choose, must occur only once. The version attribute may occur at-most-once. The interface header can also contain the attributes pointer_default and endpoint.

Interface attributes for imported files are optional. However, the top-level importing interface (also called the base interface) must have at least one uuid or local attribute. MIDL explicitly checks for one of these attributes.

The uuid Attribute

The uuid attribute designates a UUID that distinguishes one interface from other interfaces. The textual representation of a UUID is a string consisting of 8 hexadecimal digits followed by a hyphen, followed by three, hyphen-separated groups of 4 hexadecimal digits, followed by a hyphen, followed by 12 hexadecimal digits. For example:

12345678-1234-ABCD-1234-0123456789AB
 

Use the command-line utility uuidgen to generate unique identifiers.

The version Attribute

The version attribute identifies a particular version of an interface in cases where multiple versions of the interface exist. The version keyword is followed by either a pair of decimal integers separated by a period, or a single decimal integer. The first of the two integers represents the major version number, and the second represents the minor version number of an interface. If a single integer is used, it represents the major version number. Both major and minor version numbers are unsigned short integers in the range between zero and 65535, inclusive.

Leading zeros in a major or minor version-number specification are not significant. A version specification of 1.0001 is the same as 0001.001 and 1.1.

The endpoint Attribute

The endpoint attribute specifies a well-known port or ports (communication end-points) on which servers of the interface listen. Well-known port values are typically assigned by the central authority that owns the protocol.

The local Attribute

The local attribute, when used as an interface attribute, specifies that you want to use the MIDL compiler to generate header files only. Stubs are not generated and checks for transmissibility are omitted.

The pointer_default Attribute

The pointer_default attribute specifies the pointer attribute that is applied to an unattributed pointer specification in the IDL file, including unattributed pointers nested in structure and union fields and arrays. It is not applied to unattributed top-level pointer parameters, which default to ref.

Failing to supply a pointer_default attribute on an interface that contains an unattributed pointer results in a compile-time warning.