This documentation is archived and is not being maintained.


The BEGIN_OBJECT_MAP macro is obsolete. It is provided for backward compatibility. See OBJECT_ENTRY_AUTO for the current functionality.

Marks the beginning of the object map that provides support for the registration, initialization, and creation of instances of ATL COM classes.




[in] The name used for an array of object map entries.

The parameter x is the name of an array holding _ATL_OBJMAP_ENTRY structures. Each element of the array describes a COM class and its corresponding C++ implementation in terms of:

  • The CLSID of the COM class

  • COM registration code for the class

  • Class factory creation code

  • Instance creation code

  • Component category registration code

  • Class-level initialization and cleanup code

Start your object map with the BEGIN_OBJECT_MAP macro, add entries for each class with the OBJECT_ENTRY macro, and complete the map with the END_OBJECT_MAP macro. Typically, wizards create the object map and add the appropriate entries automatically, but you may occasionally need to modify this code by hand.

The object map needs to be passed to CComModule::Init to enable the module's registration, initialization, and creation code to hook into the information provided.

The example below, taken from the CIRCCOLL sample, shows a simple object map and the call to CComModule::Init from a DLL server:

   OBJECT_ENTRY(CLSID_MyCircleCollectionCreator, CMyCircleCollectionCreator)

//DLL Entry Point
extern "C"
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
   if (dwReason == DLL_PROCESS_ATTACH)
      _Module.Init(ObjectMap, hInstance);
   else if (dwReason == DLL_PROCESS_DETACH)
   return TRUE;