Chapter 6. Interface Maps
Chapter 4, “Objects in ATL,” discussed how ATL implements IUnknown
, but it covered only AddRef
and Release
completely. This chapter takes a look first at the requirements that COM makes on an object’s implementation of QueryInterface
and then at how ATL supports those requirements while still providing flexibility and extensibility.
Recall: COM Identity
From a client perspective, the rules of AddRef
and Release
are fairly stringent. Unless the client is careful about their use, objects can go away before expected or can stay around too long. However, the object is allowed to implement AddRef
and Release
in any number of ways, depending on how it wants to manage its own lifetime—for example, as a heap-based, stack-based, ...
Get ATL Internals: Working with ATL 8, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.