O'Reilly logo

ATL Internals: Working with ATL 8, Second Edition by Chris Sells, Brent Rector, Kirk Fertitta, Christopher Tavares

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 4. Objects in ATL

ATL’s fundamental support for COM can be split into two pieces: objects and servers. This chapter covers classes and concentrates on how IUnknown is implemented as related to threading and various COM identity issues, such as standalone versus aggregated objects. The next chapter focuses on how to expose classes from COM servers.

Implementing IUnknown

A COM object has one responsibility: to implement the methods of IUnknown. Those methods perform two services, lifetime management and runtime type discovery, as follows:

interface IUnknown {  // runtime type discovery  HRESULT QueryInterface([in] REFIID riid,                         [out, iid_is(riid)] void **ppv);  // lifetime management  ULONG AddRef();  ULONG Release ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required