By convention, the file that contains interface and type library definitions is called an IDL file, and has an .idl extension. In reality, the MIDL compiler will parse an interface definition file regardless of its file name extension. An interface is identified by the keyword interface.
Each interface consists of a header, which contains attributes that apply to the entire interface, and a body, which contains the remaining interface definitions.
The interface header has the following format:
[ interface-attribute-list] interface interface-name
See IDL Attributes for a summary of attributes that can replace interface-attribute-list in an interface header.
The interface body, which is enclosed in braces ({ }), contains the data types that will be used in remote procedure calls and prototypes for the functions that will be executed remotely. An interface body can contain imports, pragmas, constant declarations, type declarations, and function declarations. Except in OSF-compatibility mode, the MIDL compiler also allows implicit declarations in the form of variable definitions.
Note that the OSF-DCE specification for RPC interfaces does not allow multiple interfaces. Therefore, if you are compiling in MIDL's OSF-compatibility mode (/osf), your IDL file can have only one interface.
For more information on IDL syntax and restrictions, see the reference page for IDL in the MIDL Language Reference.
For details on using the MIDL compiler to produce type libraries, see Generating a Type Library with MIDL.