Now that we've built an in-process component in C++ that implements the ISum interface and a matching C++ client, what is the next step? Let's find a way to make our component more accessible to a wider variety of developers. Consider this: If we decided to market this component, who would our customers be? Even discounting the fact that a component with the ability to add two numbers is of limited value, only developers with a good grasp of C++ and COM+ would have any use for the component. Perhaps we could broaden our potential market a bit if we made the component accessible to developers using Microsoft Visual Basic or Java, and maybe we could even make the component easier to use from C++. (Support for scripting languages is covered in Chapter 5.)
Recall that COM+ is a binary standard for building and integrating software components, so the language used to build or call COM+ objects is irrelevant. So why is anything special required to make a component accessible to developers using heterogeneous languages? Developers using C++ typically define their interfaces in the Interface Definition Language (IDL) and then use the Microsoft IDL (MIDL) compiler to translate those interface definitions into a header file that the C++ compiler can understand. Of course, neither Visual Basic nor even Java can read C/C++ header files, but those languages still require that the interface definitions be available.
To solve this problem, the COM+ designers developed type libraries. Type libraries facilitate language integration in COM+ by making a component's interface definitions available to programming languages other than C++. Visual Basic and Microsoft Visual J++ generally depend on type libraries for their COM+ integration features. In this chapter, we'll begin with a discussion of how type libraries facilitate language integration in COM+, and then we'll examine how using type libraries can make client-side COM+ programming in C++ easier. We'll also introduce the Active Template Library (ATL), which assists in building COM+ components in C++. Finally, we'll cover COM+ issues from the perspective of Visual Basic and Visual J++.