Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Consecutive interface function IDs

Tags:

windows

com

midl

I have a COM object interface in midl like

interface InterfaceName : IDispatch
{
  [id(1)] HRESULT FunA(...);
  [id(2)] HRESULT FunB(...);
  [id(3)] HRESULT FunC(...);
}

Are the ids required to be consecutive? Or can I define it like

interface InterfaceName : IDispatch
{
  [id(1)] HRESULT FunA(...);
  [id(3)] HRESULT FunB(...);
  [id(5)] HRESULT FunC(...);
}

Compiling the second version seems to be fine but will there occur any problems at runtime?

like image 612
chrizke Avatar asked Oct 20 '22 04:10

chrizke


1 Answers

Actual id values are arbitrary numbers. They do not have to be consecutive; they just have to be unique. Zero and negative values are, by convention, reserved for certain special methods. Apart from that, there are no rules.

like image 82
Igor Tandetnik Avatar answered Oct 23 '22 01:10

Igor Tandetnik