3 ms·
Interfaces are made to match the C++ vtable. Using them from C, for example, is somewhat of a hassle. (Not to say anything about IDL…)
by Koshkin 5y ago
Interfaces are made to match the C++ vtable. Using them from C, for example, is somewhat of a hassle. (Not to say anything about IDL…)
- ntauthority 5y agoNot exactly. They use a different calling convention (for systems where 'this' pointers are normally passed in a special place) from usual C++ classes to match C-ish, and there's a few other restrictions for things (overloads, inheritance) that otherwise differ across C++ ABIs and wouldn't map well to other non-C++ languages. The C wrappers generated by MIDL are also fairly similar to raw C++, compare (where pUnk is an IUnk *): pUnk->Something(&bA); with... IUnk_Something(pUnk, &bA); which expands to something like this: pUnk->lpVtbl->Something(pUnk, &bA);