3 ms·
Being pedantic, the COM vtable layout is defined independently of C++. The Windows headers used to (and maybe still do) have macros that could declare COM vtab
by masfuerte 2mo ago
Being pedantic, the COM vtable layout is defined independently of C++. The Windows headers used to (and maybe still do) have macros that could declare COM vtables as explicit structs so you could use Windows COM interfaces from C.
That used to be the case anyway. It's possible they binned the C support in the switch to 64-bit. I haven't looked since.
- wasmperson 2mo agoYes the support is still there, although official MS documentation no longer mentions it. Some of those headers rather flagrantly violate C's strict aliasing rules, which I suspect is the reason MSVC never implemented type-based aliasing optimizations.
- rramadass 2mo agoCOM is still a language-independent binary standard. The first three entries in the vtable must always be IUnknown methods and all methods must use __stdcall calling convention. The Layout of a COM Object by Raymond Chen - https://devblogs.microsoft.com/oldnewthing/20040205-00/?p=40733 https://devblogs.microsoft.com/oldnewthing/20040205-00/?p=40...