MIDL Compilation

Given an IDL file such as example2.idl, which defines one or more COM interfaces and a type library, the MIDL compiler (Midl.exe) generates the following files as the default output:

Filename Description
Example2.h The header file, containing type definitions and function declarations for all of the interfaces defined in the IDL file, as well as forward declarations for routines that the stubs call.
Example2_p.c The proxy/stub file, which includes the surrogate entry points for both clients and servers.
Example2_i.c The interface ID file, which defines the GUID for every interface specified in the IDL file.
Example2.tlb A compound document file that contains information about types and objects.
Dlldata.c Contains the data you need to create a proxy/stub DLL.

You use the header file and all of the .c files to create a proxy DLL that can support the interface when used by both client applications and object servers. You use the interface header file (Example2.h)and the interface ID (Example2_i.c) file when creating the executable file for a client application that uses the interface. You can choose to include the type library file as a resource in your EXE or DLL, or ship it as a separate file.

For more information about these files, see Files Generated for a COM Interface, in the MIDL Programmer's Guide and Reference.