Compiling the IDL File with the MIDL Compiler

Now that you have created the IDL file that describes the COM types contained in the RawComCar.dll, you can compile it with the MIDL compiler. While you are free to run midl.exe from the command line, your task will be much simpler if you make use of Visual Studio when compiling your *.idl files. First, right-click anywhere on the open file window and select "Insert File into Project" from the context menu. The MIDL compiler itself can be configured using the MIDL tab of the project settings dialog box (found under the Project | Settings menu). By default, MIDL is set to the MkTypLib-compatible option, which means all IDL code is expected to conform under the older ODL syntax rather than modern day IDL. Be sure to turn this feature off in your raw C++ COM projects (see Figure 2-12).

Qmt frelHt 5#mmi

¿do AOTifiiiricludO ■iiflOCf a-l

1

r SiibtoEi Ennn

aw ditMtfi

|.ceouc

fiùpon'Jçî ûm

Figure 2-12: Configuring the MIDL compiler

Once you insert a *.idl file into the project workspace, you can simply right-click the file from FileView and select Compile. This activates the MIDL compiler and automatically sends the output files into your project directory. The MIDL compiler also runs automatically when you build your projects, if you have inserted one or more *.idl files.

Was this article helpful?

0 0

Post a comment