Question

Sorry for the beginner question.

In really good article Com in plain C I read this sentence:

One requirement of a COM object is that the first three members of our VTable (i.e., our IExampleVtbl struct) must be called QueryInterface, AddRef, and Release.

Is this true?

What if change names, but parameters, calling convention and return values will be same ?

Do you still work this? If not why?

Many thanks for response. (Positive or negative.)

Was it helpful?

Solution

Every COM interface must derive from IUnknown. Which provides essential services: memory management (AddRef and Release) and the ability to discover other interfaces implemented by the COM object (QueryInterface). The v-table for a COM interface therefore always starts with 3 function pointers to the implementation of these methods. The actual names of the functions or what language they were written in do not matter at all, COM only cares about the function pointers.

You can name the implementation functions anything you want. Intentionally not using the IUnknown function names is unwise.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top