<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>COM is not a language extension.<BR> <BR><br>It is a codification of a fairly obvious but not guaranteed C++ ABI/objectmodel decision.<BR> <BR><br>Specifically given C++:<BR><br> class Foo <br> { <br> public: <br> virtual void Abc() = 0; <br> virtual void Def() = 0; <br> };<BR><br> <BR> Foo* foo; <br> foo->Abc(); <BR> <BR> <BR>what is the ABI in terms of C?<BR> <BR><br>Note well the "virtual" and "=0". They are important.<BR><br> <BR>COM declares that is this (except for old CFM Macintosh PowerPC?):<BR><br> struct Foo; <br> typedef struct Foo Foo; <BR> <BR> <BR> struct FooFunctions <br> { <br> void (*Abc)(Foo*); <br> void (*Def)(Foo*); <br> };<BR> <BR> <BR> struct Foo <br> {<br> FooFunctions const * Functions; <br> }; <BR> <BR><br> Foo* foo; <br> foo->Functions->Abc(foo); <BR><br> <BR>There are other possibilities, but is what COM says.<BR><br> <BR> WinRT is seemingly merely a way to encode .h files in a binary format,<br> that then describe things like the above. <BR> <BR> <BR> There is a string library, which you can have the compiler deal with or not.<BR> There is COM's IUnknown, ditto.<BR> <BR> <BR><br> That is really about it as I understand.<BR> <BR><br>What is "system compiler"?<br>The OS is likely compiled with multiple compilers.<br>It certainly can run binaries compiled with multiple compilers.<BR>What is in question, I guess, is what is the ABI.<br>The C ABI, and the C++ ABI.<br>C ABIs are generally smaller more obvious but not completely automatic things.<br>Struct passing and return being one of the less obvious aspects.<BR> <BR><br>Ideally there'd be documentation and agreement on the C ABI.<BR><br>C++ ABIs include lots of details -- name mangling, exception handling....<BR>That is much more difficult to deal with.<BR>Name mangling in Visual C++ has changed through the years.<BR>For example, years ago, template parameters were not encoded in function names, so multiple instances of this:<BR> <BR>template <int a> int Foo() {return a;}<BR>or this:<BR>template <typename T> T* New() {return new T;}<BR> <BR> <BR>got the same name.<BR> <BR> <BR> Foo<1>();<BR> Foo<2>(); <BR> New<short>(); <BR> New<long>(); <BR> <BR> <BR> <BR> and the linker would just pick one..oops.. <BR> <BR> <BR>Fixing that required an ABI change.<BR>So it is a good thing the original name mangling wasn't documented and copied!<BR>(Better still would be to get it right the first time..)<BR> <BR> <BR><br> - Jay<BR> </div></body>
</html>