Tuesday, January 16, 2007

COM (Common Object Model)

To summarize, COM defines several basic fundamentals that provide the underpinnings of the object model. The binary standard allows components written in different languages to call each other's functions. Interfaces are logical groups of related functions—functions that together provide some well-defined capability. IUnknown is the interface that COM defines to allow components to control their own life span and to dynamically determine another component's capabilities. A component object implements IUnknown to control its life span and to provide access to the interfaces it supports. A component object does not provide direct access its data. GUIDs provide a unique identifier for each class and interface, thereby preventing naming conflicts. And finally, the Component Object Library is implemented as part of the operating system and provides the "legwork" associated with finding and launching component objects.

The core of the Component Object Model is a specification for how components and their clients interact. As a specification, it defines a number of other standards for interoperability of software components:

  • A binary standard for function calling between components
  • A provision for strongly-typed groupings of functions into interfaces
  • A base IUnknown interface providing:
    • A way for components to dynamically discover the interfaces supported by other components (QueryInterface)
    • Reference counting to encapsulate component lifetime (AddRef and Release)
  • A mechanism to uniquely identify components and their interfaces (GUIDs)

No comments: