IUnknown explained

In computer programming, the IUnknown interface is the fundamental interface in the Component Object Model (COM). The COM specification mandates that COM objects must implement this interface. Furthermore, every other COM interface must be derived from IUnknown. IUnknown exposes two essential features of all COM objects: object lifetime management through reference counting, and access to object functionality through other interfaces.

An IUnknown (or IUnknown-derived) interface consists of a pointer to a virtual method table that contains a list of pointers to the functions that implement the functions declared in the interface, in the order that they are declared in the interface. The in-process invocation call overhead is therefore identical to virtual method calls in C++.[1]

Methods

The IUnknown interface exposes three methods: QueryInterface, AddRef, and Release:[2]

interface IUnknown ;The IUnknown interface ID is defined as a GUID with the value of .

A COM component's interfaces are required to exhibit the reflexive, symmetric, and transitive properties. The reflexive property refers to the ability for the QueryInterface call on a given interface with the interface's ID to return the same instance of the interface. The symmetric property requires that when interface B is retrieved from interface A via QueryInterface, interface A is retrievable from interface B as well. The transitive property requires that if interface B is obtainable from interface A and interface C is obtainable from interface B, then interface C should be retrievable from interface A.

Miscellaneous

See also

External links

Notes and References

  1. Web site: The Component Object Model . 30 May 2018 . microsoft.com . Microsoft . 12 February 2019.
  2. http://msdn2.microsoft.com/en-us/library/ms680509.aspx IUnknown definition
  3. http://msdn2.microsoft.com/en-us/library/aa751968.aspx ActiveX Controls
  4. https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFPlugIns/CFPlugIns.pdf Plug-ins