IUnknown

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++.

Methods
The IUnknown interface exposes three methods:,  , and  : The IUnknown interface ID is defined as a GUID with the value of {00000000-0000-0000-C000-000000000046}.
 * allows the caller to retrieve references to the interfaces that the component implements. It is similar to  in C++ or casts in Java and C#. Specifically, it is used to obtain a pointer to another interface, given a GUID that uniquely identifies that interface (commonly known as an interface ID, or IID). If the COM object does not implement that interface, an E_NOINTERFACE error is returned instead.
 * is used to increment the reference count when a new client is acquiring the object. It returns the new reference count.
 * is used to decrement the reference count when clients have finished using the object. It returns the new reference count. The object will delete itself during release when the reference-count reaches zero, which means that the caller must never use an interface after calling Release.

A COM component's interfaces are required to exhibit the reflexive, symmetric, and transitive properties. The reflexive property refers to the ability for the  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, 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

 * Components designed under the ActiveX visual component standard must, at a minimum, implement the IUnknown interface.
 * IUnknown serves as the base for Mac OS X's Core Foundation CFPlugIn framework.
 * In Mozilla's XPCOM component model, this interface is also known as nsISupports.