4 ms·
COM is based off of the C ABI not C++. This was done specifically because C++ does not have a stable ABI.
by jdsully 7y ago
COM is based off of the C ABI not C++. This was done specifically because C++ does not have a stable ABI.
- pjmlp 7y agoThere is no such thing as C ABI, rather Windows ABI, which you can even select several calling conventions, including Pascal based one. COM is based on the way Visual C++ lays out the VMT, and only masochists use it from bare bones C.
- int_19h 7y agoC ABI is basically structs + functions + function pointers. On Win32, functions and function pointers includes calling conventions, but that's not really important. COM is a C ABI in a sense that its spec defines everything in these terms. Yes, in practice it translates nicely to C++ vtables, but the stability guarantees are defined on the lower level.
- pjmlp 7y agoFrom that point of view, it is also a Pascal ABI.
- int_19h 7y agoSure, and several dozen other languages. That's really what it is - the lowest common denominator that almost every language can work with.
- pjmlp 7y agoAs the OS ABI should be.
- int_19h 7y agoThis is a kind of a chicken and egg thing - it is the OS ABI because everybody supports it, and everybody supports it because it's the OS ABI. I think that the fact that it has the features that it does is mostly a coincidence of timing, and languages popular at the time on platforms that were popular enough. If it happened 15 years later, the feature set might have been larger.