next up previous contents index
Next: 4.1.1 Interface Inheritance and Up: 4 The Component Object Previous: 4 The Component Object

4.1 Objects and Interfaces

The COM dynamic dispatch facility revolves around the fundamental concepts of objects and interfaces. An object in COM is a fairly abstract concept, not necessarily associated with a particular data structure in memory like C++ or Java objects. A COM object can be implemented in any language and can maintain its internal state in any way it chooses; as far as COM is concerned, the only thing relevant about the object is its interfaces. A client accessing a COM object generally does not have direct access to the actual data contained in the object; instead COM objects are only accessible through the set of interfaces the object exports. A reference to a COM object is really just a pointer to one of the object's interfaces. An object may support any number of interfaces; each interface represents one particular ``view'' of the object, or one ``protocol'' through which the object can be accessed. Each interface has its own dynamic dispatch table, consisting of a few standard methods (function pointers) whose calling conventions and semantics are defined by COM, followed by an arbitrary number of custom methods whose calling conventions and semantics are specific to that particular interface.

Although the COM specification defines a few basic interfaces, anyone can independently define new COM interfaces, and in fact the OSKit defines quite a number of such interfaces. COM interfaces are identified by 128-bit globally unique identifiers (GUIDs), which are algorithmically generated through various standardized mechanisms; this avoids all the accidental collisions that can easily occur when human-readable names are used as identifiers. COM GUIDs are the equivalent to and compatible with the Universally Unique Identifiers (UUIDs) used in the Distributed Computing Environment (DCE) originally developed at Apollo and the Open Software Foundation (OSF). Although COM interfaces generally also have human-readable names such as IUnknown and IStream, these names are only for the programmer's benefit at development time; they get compiled out in the final program and only the GUIDs are used at run-time.




next up previous contents index
Next: 4.1.1 Interface Inheritance and Up: 4 The Component Object Previous: 4 The Component Object

University of Utah Flux Research Group