Containment Delegation  «Prev  Next»
Lesson 4 Integrating components: COM component advantages
Objective Understand the advantages of integrating COM components.

Integrating components: COM Component Advantages

Elvis doesn't have to rebuild his code because it has no source-code based dependencies on any interfaces or objects in CBIComp.dll. The include files used for interface definitions contained in COM objects within CBIComp.dll define only vtable order and parameters. Recall that these methods are all defined as pure virtual, and COM interface pointers are not instantiated by new. Instead, the address of the pointer is passed into IClassFactory::CreateInstance (directly or via CoCreateInstance) or IUnknown::QueryInterface. These calls are implemented by a class factory or COM object within the server. The server allocates memory for the COM object and its interfaces, and assigns the interface pointer into the caller's pointer. The integration between a COM object and client is through the object's CLSID and interface specifications only--that is, a COM class. The actual hookup of client code to a COM object is done at runtime. As long as the object's CLSID and interface definitions remain unchanged, component users can safely integrate with components without rebuilding their applications. To support this, we say that all COM interfaces are immutable that is, once a COM interface is published or distributed, it can't change.
This lesson demonstrated how COM clients and objects integrate at a binary level. In following lessons, we will examine how software components support reusability.

  1. Source-code based dependencies
  2. Reusability

Integration Com Client Objects - Quiz

Click the Quiz link below to check your understanding of COM client and interface integration.
Integration COM Client Objects - Quiz