[cfe-dev] COM ABI support?

Stephen Lin swlin at post.harvard.edu
Wed Jul 10 17:14:19 PDT 2013


Hi all,

Just curious, does anyone know how much of the Microsoft COM ABI
subset of the MSVC C++ ABI Clang currently supports? Can clang be used
to implement COM objects and interfaces using C++ inheritance (i.e.
instead of using C-style explicit function tables, etc.?)

(I'm hoping this is a cogent question rather than something which
reveals my ignorance/misunderstanding of the situation...)

Thanks!
Stephen

---------- Forwarded message ----------
From: Stephen Lin <swlin at post.harvard.edu>
Date: Thu, Jul 4, 2013 at 8:22 PM
Subject: Re: [cfe-dev] libc++ in Windows
To: Óscar Fuentes <ofv at wanadoo.es>
Cc: cfe-dev at cs.uiuc.edu


> MSHTML has a COM interface. And I wouldn't consider it a core library by
> any stretch. Dunno about JSCRIPT but I'll bet that it is the same case.
> For core (OS) functionality, it is in the best interest of MS to not
> block access to other compiler vendors. Also, historically MS promoted
> other languages over C++ and that means that its libraries hide its C++
> implementation behind a COM/C interface.
>
> To recap: there is no problem using C++ runtimes other than MS on
> Windows. MinGW does it, Borland does it...
>

Just curious, because I couldn't find much discussion of COM in the
archives...do you know if Clang currently supports enough of the
ms-cxx-abi to use and generate COM objects and interfaces in C++?

It's been awhile since I've used COM so I might be misremembering what
it is, but my understanding is that COM idl files can be used to
generate header files that can either be used in C (using explicit
tables of function pointers to implement interfaces and dynamic
dispatch) or C++ via inheritance, and MSVC's C and C++ ABIs are
designed such that both alternatives will generate code that conforms
to the same ABI using MSVC, which is stable across MSVC versions.

Also, as I understand it, having C++ objects conform to the COM ABI
primarily depends on things like virtual table layout but has no
dependence on things like name mangling, since all dispatch is
indirect through table lookups--is that correct? If so, is COM ABI
support complete or is there anyone working on that an an explicit
subgoal of full MSVC ABI support?

Stephen




More information about the cfe-dev mailing list