ATL END_COM_MAP macro is defined as follows:
#define END_COM_MAP() \
__if_exists(_GetAttrEntries) {{NULL, (DWORD_PTR)_GetAttrEntries, _ChainAttr }, }\
{NULL, 0, 0}}; return _entries;} \
virtual ULONG STDMETHODCALLTYPE AddRef( void) throw() = 0; \
virtual ULONG STDMETHODCALLTYPE Release( void) throw() = 0; \
STDMETHOD(QueryInterface)(REFIID, void**) throw() = 0;
It is intended to be used within definition of classes inherited from COM interfaces, for example:
class ATL_NO_VTABLE CMyClass :
public CComCoClass<CMyClass, &MyClassGuid>,
public CComObjectRoot,
public IMyComInterface
{
public:
BEGIN_COM_MAP( CMyClass )
COM_INTERFACE_ENTRY( IMyComInterface)
END_COM_MAP()
};
This means that QueryInterface(), AddRef() and Release() are declared as pure virtual in this class. Since I don't define their implementation this class should be uncreatable. Yet ATL successfully instantiates it.
How does it work and why are those IUnknown member functions redeclared here?