It is not uncommon for COM objects to return references to other COM objects, either as a property value or via an object method. If an IDLcomIDispatch object returns a reference to another COM object’s IDispatch interface, IDL automatically creates an IDLcomIDispatch object to contain the object reference.

For example, suppose the GetOtherObject method to the COM object encapsulated by the IDLcomIDispatch object Obj1 returns a reference to another COM object.

Obj2 = Obj1->GetOtherObject()

Here, Obj2 is an IDLcomIDispatch object that encapsulates some other COM object. Obj2 behaves in the same manner as any IDLcomIDispatch object.

Note that IDLcomIDispatch objects created in this manner are not linked in any way to the object whose method created them. In the above example, this means that destroying Obj1 does not destroy Obj2. If the COM object you are using creates new IDLcomIDispatch objects in this manner, you must be sure to explicitly destroy the automatically-created objects along with those you explicitly create, using the OBJ_DESTROY procedure.