Chapter 15: The COM Library
It should be clear by this time that COM itself involves some systems-level code, that is, some implementation of its own. However, at the core the Component Object Model by itself is a specification (hence Model) for the way objects and their clients interact through the binary standard of interfaces. As a specification it defines a number of other standards for interoperability:
- The fundamental process of interface negotiation through QueryInterface.
- A reference counting mechanism through objects (and their resources) are managed even when connected to multiple clients.
- Rules for memory allocation and responsibility for those allocations when exchanged between independently developed components.
- Consistent and rich error reporting facilities.
In addition to being a specification, COM is also an implementation contained what is called the COM Library. The implementation is provided through a library (such as a .DLL on Microsoft Windows) that includes:
- A small number of fundamental API functions that facilitate the creation of COM applications, both clients and servers. For clients, COM supplies basic object creation functions; for servers the facilities to expose their objects.
- Implementation locator services through which COM determines from a class identifier which server implements that class and where that server is located. This includes support for a level of indirection, usually a system registry, between the identity of an object class and the packaging of the implementation, such that clients are independent of the packaging which can change in the future.
- Transparent remote procedure calls when an object is running in a local or remote server. This includes the implementation of a standard network wire-protocol.
- A standard mechanism to allow an application to control how memory is allocated within its process.
In general, only one vendor needs to, or should, implement a COM Library for any particular operating system. For example, Microsoft has implemented COM on Microsoft® Windows® 3.1, Microsoft Windows 95, Microsoft Windows NT, and the Apple® Macintosh®.
The following chapter describes elements of the COM Library that a vendor implementing COM on a previously unsupported platform would require.
You can read through this chapter, or choose a topic of interest from this list:
- Component Object Model Network Protocol
- Overview
- Data Types and Structures
- IRemUnknown Interface
- The Object Exporter
- Service Control Manager
- Wrapping DCE RPC Calls to Interoperate with ORPC
- Implementing ORPC in RPC