On 32-bit platforms, the preferred method for defining an interface is to write a script in the Interface Definition Language (IDL), which is based, once again, on the OSF DCE standard. In this language, you can describe interfaces, member functions, and attributes of those functions and their arguments. IDL is preferred because COM can extend it quite readily to support distributed services when the time comes.
This chapter will not discuss IDL in any detail, as that subject is covered in Chapter 6. The full specifications exist in the Microsoft Win32 Remote Procedure Call Programmer's Guide and Reference. For now it is enough to say that once you've written an IDL script, you run it through the Microsoft IDL compiler (MIDL.EXE, part of the Win32 SDK), which pumps out the header file mess that we saw earlier. MIDL actually does more, such as generating source code for a proxy and stub that can marshal the interface across a process boundary, but that also is a subject for Chapter 6. What is important here is that the header files are necessary for both the object's implementation of that interface and for a client's compilation of code that uses the interface. This does assume, of course, that everything is written in C or C++, which is why there are type libraries. Type libraries contain the same information as a MIDL-generated header file but are language-independent. As we'll see in the next chapter, you use the Object Description Language (ODL), which is similar to and actually a superset of IDL, to define the information that ends up in a type library.
Note: IDL is simply a convenience for programmers; it is not necessary to use it to define an interface or even to provide marshaling for an interface. Microsoft expects that in time there will be better tools for defining interfaces, such as point-and-click editors that generate the IDL scripts themselves.