World Library  
Flag as Inappropriate
Email this Article




In computer programming, the IUnknown (custom) interface is the fundamental interface in the Component Object Model (COM). The published COM specification mandates that COM objects must minimally 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 various predefined interfaces.

A custom IUnknown 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 same order that they are declared in the interface. The in-process invocation overhead is therefore comparable to virtual method calls in C++.


  • Methods 1
  • Miscellaneous 2
  • See also 3
  • References 4
  • External links 5


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

  • QueryInterface allows the caller to retrieve references to different interfaces the component implements. It is similar to dynamic_cast<> 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.
  • AddRef is used to increment the reference count when a new client is acquiring the object. It returns the new reference count.
  • Release is used to decrement the reference count when clients have finished using the object. It returns the new reference count. The COM object will delete itself when the reference-count reaches zero.
interface IUnknown {
  virtual HRESULT QueryInterface (REFIID riid, void **ppvObject) = 0;
  virtual ULONG   AddRef () = 0;
  virtual ULONG   Release () = 0;

The IUnknown interface ID is defined as a GUID with the value of {00000000-0000-0000-C000-000000000046}.

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.


  • Components designed under the ActiveX standard must, at a minimum, implement the IUnknown interface.[2]
  • IUnknown serves as the base for Mac OS X's Core Foundation CFPlugIn framework.[3]
  • In Mozilla application development, this interface is also known as nsISupports.

See also


  1. ^ IUnknown definition at; accessed 18-Jan-2008
  2. ^ ActiveX Controls at; accessed 18-Jan-2008
  3. ^ Plug-ins at; accessed 18-Sept-2011

External links

  • COM in plain C
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.

Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.