Navigation:  Programming Cookbook > Creating COM Components > Building a COM component >

Build Type Library

Previous pageReturn to chapter overviewNext page

Building a type library is the straightforward process of running one’s IDL through the MIDL compiler.

The MIDL compiler is supplied with the Microsoft Platform SDK (available for free download from Microsoft). To build a type library from IDL one typically uses a simple command line such as:

       MIDL /Oicf <idl file>


If you are not using type-library marshalling, then you will have to build a marshalling DLL in order to be able to use your component from an external client (see Standard Marshalling).

The type-library for the Random Stream sample is supplied pre-built and can be found as Random.tlb in the <my documents dir>\Dolphin Smalltalk 5.1\Object Arts\Samples\ActiveX\Random folder. If you don’t have MIDL available, then just use the pre-built tlb, otherwise:

MIDL /Oicf random.idl


This should emit a number of files, including random.tlb.

In practice, you are bound to get errors when compiling your own the IDL, which you will have to work through until it spits out the type-library. MIDL’s error reporting can be a little poor, which is another good reason to start with minimal IDL and build up incrementally.