Request assistance binding to Windows dsound.{lib, dll}
Kagamin via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri May 27 09:08:27 PDT 2016
On Friday, 27 May 2016 at 15:28:42 UTC, Andrew Edwards wrote:
>> Have you tried with extern(C) yet?
>> extern(C) is for undecorated symbold
>> extern(Windows) adds the _ and @12 decorations (would be
>> __stdcall on C/C++ side)
>
> The thought never crossed my mind. Tried it and it works like a
> charm. Thanks to everyone who responded.
If you declare extern function with wrong calling convention,
calling it can result in stack corruption.
> Once DirectSoundCreate() returns successfully, I need to call
> one of the function pointers in the struct but am at a loss of
> how to define it based on the interface presented.
This struct is called COM interface, D has built-in support for
them: https://dlang.org/spec/interface.html#com-interfaces
More information about the Digitalmars-d-learn
mailing list