Platform SDK: COM

MIDL Compiler

The MIDL compiler processes an IDL file to generate a type library and output files. The type of output files generated by the MIDL compiler depends on the attributes specified in the IDL file's interface attribute list.

If the attribute list contains the object keyword, the MIDL compiler generates COM interface output files: an interface proxy file, an interface header file, and a globally unique identifier (GUID) file for the interface. If the IDL file contains a library statement, MIDL generates a type library file with the .tlb file name extension. If there are any interfaces in the IDL file that do not have the object keyword and are not enclosed in a library statement, the MIDL compiler generates interface output files appropriate for remote procedure calls (RPCs): a client stub file, a server stub file, and a header file. For more information, see the topic Interface Definitions and Type Libraries and Generating a Type Library with MIDL in the MIDL Programmer's Guide and Language Reference in the Platform SDK.

To generate a type library and output files from an IDL file

•    From the command prompt, run

midl filename

where filename is the name of the IDL file.

The MIDL compiler also supports several optional parameters. For a complete list, see "MIDL Command-Line Reference" in the Visual C++ documentation, or run the following command line:

midl /?

Note  If the IDL file that you compile includes other IDL files, you must set your INCLUDE environment variable to point to the directories containing those files.

For more information about using the MIDL compiler, see the Visual C++ documentation.