[cfe-dev] COM ABI support?

Kim Gräsman kim.grasman at gmail.com
Thu Jul 11 04:43:40 PDT 2013


Hi Nico,

On Thu, Jul 11, 2013 at 1:26 PM, Nico Rieck <nico.rieck at gmail.com> wrote:
> On 11.07.2013 04:10, Stephen Lin wrote:
>>
>> Correct me if I'm wrong, but, as I understand it (my last usage of COM
>> was maybe 10 years ago...), COM interfaces are a language-independent
>> ABI that happen to be implementable using C++ virtual inheritance
>> using MSVC.
>
> COM uses pure abstract base classes, but *not* virtual inheritance. Which
> makes for a simpler vtable layout. And is the reason why you have to be
> careful returning the correct pointer in IUnknown::QueryInterface (COM's
> dynamic_cast on steroids) when inheriting from multiple interfaces.

I was about to answer the same thing, but hesitated. I know COM avoids
use virtual inheritance, and I think I've heard somebody say it's for
portability.

But the vtable ABI isn't standardized either, is it? Do all compilers
just happen to implement it the same way?

Thanks,
- Kim



More information about the cfe-dev mailing list