[WinAPI] Problem with an interface...

Sascha Katzner sorry.no at spam.invalid
Thu Nov 22 08:02:10 PST 2007


Frits van Bommel wrote:
> Interfaces are only compatible with non-D code if they're COM interfaces 
> (i.e. derive from IUnknown). Other interfaces are D(-compiler)-specific 
> and thus incompatible with non-D code. This also means that "interfaces" 
> returned from non-D code that don't derive from IUnknown can't be 
> declared using 'interface'. However, if you know how to call their 
> functions from C you can still use the C-like way to access them (using 
> structs and explicitly accessing the vtable, for example).
> 
> Non-COM interfaces use a D-specific vtable layout (causing you to call a 
> different function) and calling convention (but you may've gotten 
> "lucky" with two no-argument functions).

But IUnknown itself is declared as an D interface:

com.d:
> interface IUnknown
> {
>     HRESULT QueryInterface(IID* riid, void** pvObject);
>     ULONG AddRef();
>     ULONG Release();
> } 

...or is this only some kind of false front, and the real implementation 
  is hidden behind some compiler magic?

LLAP,
Sascha Katzner



More information about the Digitalmars-d mailing list