directx bindings problem

Benjamin Thaut code at benjamin-thaut.de
Tue Oct 29 12:40:40 PDT 2013


So I found it. Its actually your fault.

IXAudio2Voice isn't a COM interface. That means it should _not_ inherit 
from IUnkown. But if it isn't a COM interface it can't be a regular D 
interface either, because if it is a regular D-Interface it will not 
have a v-table layout that conforms with C++. That means you have to put 
"extern(C++)" in front of IXAudio2Voice to make it work.

So to make stuff work you should change

interface IXAudio2Voice : IUnknown

to

extern(C++) interface IXAudio2Voice

Then everything works fine.

Tip for the future: Using the "Microsoft Symbol Server" and the Visual 
Studio Debugger you can easily verify if your COM interfaces call the 
correct methods or if you messed up the declarations.

Kind Regards
Benjamin Thaut


More information about the Digitalmars-d-learn mailing list