COM interfaces are Immutable
Interface is not allowed to change
The phrase "COM interfaces are immutable" means that once a COM interface is published or deployed, its specification is not allowed to change. This applies even if different COM objects implement that interface.
For example, once interface IX1
is published or deployed, all COM objects that implement IX1
must implement the interface exactly as specified. So if IX1
has the following IDL (interface definition language) definition:
[object,uuid(...)]
interface IX1 : IUnknown
{
HRESULT x1(int ix);
HRESULT x2();
}
Interface
An interface is a set of method prototypes. To utilize a method of an interface, a client should get a pointer to the interface.
This pointer, if available, is returned by QueryInterface upon request by a client. Every component is required to have an IUnknown interface. A client program, which has requested the system to instantiate a component, will have a pointer to the component. Using this pointer and the QueryInterface method of the IUnknown interface, a client can get a pointer to any interface available from the component. Calling the QueryInterface method asking for an interface is called interface negotiation. Interface negotiation is reflexive, symmetric, and transitive, which is also known as an equivalence relation in discrete mathematics.
[1]vtable aka virtual table: For every class that contains virtual functions, the compiler constructs a virtual table, vtable. The vtable contains an entry for each virtual function accessible by the class and stores a pointer to its definition. Only the most specific function definition callable by the class is stored in the vtable.