General MIDL Command-line Syntax

The MIDL compiler processes an IDL file and an optional application configuration file (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.

Switch Options

     midl [command-line-switch [switch-options]] filename
    

command-line-switch

Specifies MIDL compiler command-line switches. Switches can appear in any sequence.

switch-options

Specifies options associated with each 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 another or none.

Remarks

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 an extension other than .idl, or no extension at all.

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:

  • Client stub (name_c.c)
  • Server stub (name_s.c)
  • Header file (name.h)

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

  • Interface proxy file (name_p.c)
  • Interface header file (name.h)
  • Interface UUID file (name_I.c)

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.

 

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

Starting with MIDL version 6.0.359, the default command line option for the MIDL compiler is /Oicf /robust. To disable /robust, specify the /no_robust option.

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.