AddRef_MC endp

 

AddRef is a bit unusual in that it does not return a HRESULT (failure code), instead it returns the object count. The return value is undefined in the COM contract, but it is traditional to return the count.

 

Release not only has to decrement the object count, but when this count reaches zero it must both delete the object, and delete the object count of the dll (such that when the object count goes to zero the dll may be unloaded). Again, this is a trivial implementation: