On Tuesday, 29 October 2013 at 19:40:40 UTC, Benjamin Thaut wrote:
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
Whoa! This did the trick with XAudio2! Thank you very much. I'll
have the C++ linkage in mind for the rest of the DirectX APIs.
One question: Should the other interfaces like IXAudio2 for
example use extern(C++) whether they are COM interfaces or not?
I'll also take your tip. I got the link for the symbol server. Do
you have a link for a tutorial or something for the Visual Studio
Debugger? I'd like more info about it. I assume the debug
information from DMD is compatible with this debugger, right?
Thank you again for your help and time.