OpEquals and Interfaces

Don nospam at nospam.com
Wed Apr 14 12:45:18 PDT 2010


Kagamin wrote:
> Steven Schveighoffer Wrote:
> 
>> Walter, can you confirm that extern(C++) interfaces are equivalent to  
>> inheriting IUnknown?  If not, what are the differences?
> 
> The difference is COM ABI is standardized, C++ ABI is implementation-defined. If you are lucky, you can guess, which ABI is meant by extern(C++).

Well, yes, but C++ itself doesn't have interfaces. A COM interface is 
basically a MSVC virtual function table. Windows C++ compilers which 
support it, follow the Microsoft calling conventions, even if they use a 
different ABI for other classes.

The only problem would be if C++ subsequently defined interfaces (in 
C++1x) and they were different. I think that's extremely unlikely, since 
MSVC defines __interface to be a COM interface.

Note that extern(C++) is much more recent than the COM interface hack.



More information about the Digitalmars-d mailing list