General MIDL Command-line Syntax

midl [switch [switch-options ]] filename

switch
Specifies MIDL compiler command-line switches. Switches can appear in any sequence.
switch-options
Specifies options associated with switch. Valid options are described in the reference entry for each MIDL compiler switch.
filename
Specifies the name of the IDL file. This file usually has the extension .IDL, but it can have any extension or no extension.

Remarks

The MIDL compiler processes an IDL file and an optional ACF to generate a set of output files. The attributes specified in the IDL file's interface attribute list determine whether the compiler generates source files for an RPC interface or for a custom OLE interface. The following lists show the default names of the files generated for an IDL file named name.IDL. You can use command-line switches to override these default names. Note that the name of the IDL file can have no extension, or it can have an extension other than .IDL.

By default (that is, if the interface attribute list does not contain the object or local attribute), the compiler generates the following files for an RPC interface:

When the object attribute appears in the interface attribute list, the compiler generates the following files for a COM interface:

When the local attribute appears in the interface attribute list, the compiler generates only the interface header file, name.H.

The MIDL compiler provided with Microsoft® RPC invokes the C preprocessor as needed to process the IDL file. It does not automatically invoke the C compiler to compile generated files.

Note  The MIDL compiler provided with Microsoft RPC uses a different command-line syntax than the DCE IDL compiler uses.

The MIDL compiler switches /env, /server, /sstub, and /out affect the server stub file.

The Header File

The header file contains definitions of all the data types and operations declared in the IDL file. The header file must be included by all application modules that call the defined operations, implement the defined operations, or manipulate the defined types.

The MIDL compiler switches /header and /out affect the header file.