Request assistance binding to Windows dsound.{lib, dll}

Andrew Edwards via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri May 27 12:24:45 PDT 2016


On Friday, 27 May 2016 at 17:49:56 UTC, Adam D. Ruppe wrote:
> On Friday, 27 May 2016 at 17:37:38 UTC, Andrew Edwards wrote:
>>     extern (C) class IDirectSound : IUnknown
>
>
> That should just be `interface IDirectSound : IUnknown`

Thanks for the clarification. That actually compiles but results 
in access violation at the call site which takes place after 
verifying that the call to DirectSoundCreate() succeeded:

     if (SUCCEEDED(sound.SetCooperativeLevel(window, 
DSSCL_PRIORITY)))
     {
         MessageBoxA(null, "Hott Damn!!", null, 
MB_ICONINFORMATION);
     }
     else
     {
         MessageBoxA(null, "Naaah Man! Dat cyaan wuk!", null, 
MB_ICONINFORMATION);
     }

Output:

     object.Error@(0): Access Violation
     --------------
     0x00402700 in void sound.initSound(void*) at
     C:\Users\edwarac\work\sound\code\sound.d(555)
     0x004021A2 in int sound.myWinMain(void*, void*, char*, int) at
     C:\Users\edwasac\work\sound\code\sound.d(210)
     0x00402050 in WinMain at
     C:\Users\edwasac\work\sound\code\sound.d(154)
     0x00422B4A in WinMainCRTStartup
     0x76DF3744 in BaseThreadInitTrunk
     0x7721A064 in RtlSetCurrentTransaction
     0x7721A02F in RtlSetCurrentTransaction


More information about the Digitalmars-d-learn mailing list