Wrong vtable for COM interfaces that don't inherit IUnknown

Nicholas Wilson iamthewilsonator at hotmail.com
Tue Jul 16 01:33:40 UTC 2019


On Monday, 15 July 2019 at 22:01:25 UTC, KytoDragon wrote:
> I am currently trying to write a XAudio2 backend and have come 
> across the problem, that some of the interfaces for XAudio2's 
> COM objects seem to be missing the first entry in their vtable. 
> After reading the iterface article in the spec 
> (https://dlang.org/spec/interface.html#com-interfaces) it seems 
> that only interfaces inheriting from 
> core.stdc.windows.com.IUnknown (or any interface named 
> "IUnknown") get the COM interface layout instead of the D 
> layout.
>
> What can I do to get the COM layout on interfaces that don't 
> inherit IUnknown?
> Examples: IXAudio2Voice or any of the IXAudio2*Callback 
> interfaces. I have already declared everything extern(Windows), 
> but that does not fix it.

 From memory COM interfaces are really just `extern(C++) 
interface`s, so

extern(C++) interface IXAudio2Voice
{
     //methods...
}

should do the trick




More information about the Digitalmars-d-learn mailing list