October 06, 2013
oh, on the second thought after some tests, i encountered major ABI(or should i say MS 'optimization'?) mismatch which requires almost any function to be wrapped within C++ code to work, i doubt it would ever costs such efforts for me.

so i'm tired off both C++ and D. and programming in general. hate hate hate ...
October 06, 2013
Am 06.10.2013 07:25, schrieb evilrat:
> oh, on the second thought after some tests, i encountered major ABI(or
> should i say MS 'optimization'?) mismatch which requires almost any
> function to be wrapped within C++ code to work, i doubt it would ever
> costs such efforts for me.
>
> so i'm tired off both C++ and D. and programming in general. hate hate
> hate ...

Whats the ABI mismatch?
October 07, 2013
On Sunday, 6 October 2013 at 16:45:59 UTC, Benjamin Thaut wrote:
> Am 06.10.2013 07:25, schrieb evilrat:
>> oh, on the second thought after some tests, i encountered major ABI(or
>> should i say MS 'optimization'?) mismatch which requires almost any
>> function to be wrapped within C++ code to work, i doubt it would ever
>> costs such efforts for me.
>>
>> so i'm tired off both C++ and D. and programming in general. hate hate
>> hate ...
>
> Whats the ABI mismatch?

a simple example is dxgi.present which takes 2 uint's.
here is the same code for C++ and D.
--------------------------
MSVC++ 2012 disasm

    g_pSwapChain->Present( 0, 0 );
00CC1DC7  mov         esi,esp
00CC1DC9  push        0
00CC1DCB  push        0
00CC1DCD  mov         eax,dword ptr ds:[00CC9160h]
00CC1DD2  mov         ecx,dword ptr [eax]
00CC1DD4  mov         edx,dword ptr ds:[0CC9160h]
00CC1DDA  push        edx
00CC1DDB  mov         eax,dword ptr [ecx+20h]
00CC1DDE  call        eax
00CC1DE0  cmp         esi,esp
00CC1DE2  call        __RTC_CheckEsp (0CC117Ch)
(last call i think is just for debug in visual studio)

--------------------------
DMD 2.063.2 disasm

	g_pSwapChain.Present( 0, 0 );
0042CD91  push        0
0042CD93  push        0
0042CD95  mov         eax,dword ptr ds:[0050C120h]
0042CD9A  mov         ecx,dword ptr fs:[2Ch]
0042CDA1  mov         edx,dword ptr [ecx+eax*4]
0042CDA4  mov         ebx,dword ptr [edx+48h]
0042CDAA  mov         esi,dword ptr [ebx]
0042CDAC  push        esi
0042CDAD  mov         eax,dword ptr [esi]
0042CDAF  call        dword ptr [eax+20h]
(crashes on call)

so what's exactly happens here, it stores some string(?), it pushes args according to stdcall, move pointers to registers and calls this method. since my  asm is quite sucks i can only think it expects eax to be func ptr? but how then it returns HRESULT?

i simply made a wrapper function which takes g_pSwapChain ptr, this 2 uint's and simply call that method on a C++ side, so all pointers are correct.

now i really don't know what the problem, maybe this is just 2.063.2 broken?
October 29, 2013
omg, almost a month passed and i even didn't notice it.

after some "research" i'm still don't know what the problem. some COM calls works, some fails(probably wrong method calls, and it not crashes just because same args). now i have half working d3d11 and not working at all xaudio2.

due to some messiness i don't publish d3d11 yet. but i need help with XAudio2, if anyone know what the problem please see my repo on github and reply me :(

https://github.com/evilrat666/directx-d

p.s. though xinput is fun and working :)
October 29, 2013
Am 29.10.2013 10:38, schrieb evilrat:
> omg, almost a month passed and i even didn't notice it.
>
> after some "research" i'm still don't know what the problem. some COM
> calls works, some fails(probably wrong method calls, and it not crashes
> just because same args). now i have half working d3d11 and not working
> at all xaudio2.
>
> due to some messiness i don't publish d3d11 yet. but i need help with
> XAudio2, if anyone know what the problem please see my repo on github
> and reply me :(
>
> https://github.com/evilrat666/directx-d
>
> p.s. though xinput is fun and working :)

Is there are repro case for your problem?
October 29, 2013
On Tuesday, 29 October 2013 at 11:47:00 UTC, Benjamin Thaut wrote:
> Am 29.10.2013 10:38, schrieb evilrat:
>> omg, almost a month passed and i even didn't notice it.
>>
>> after some "research" i'm still don't know what the problem. some COM
>> calls works, some fails(probably wrong method calls, and it not crashes
>> just because same args). now i have half working d3d11 and not working
>> at all xaudio2.
>>
>> due to some messiness i don't publish d3d11 yet. but i need help with
>> XAudio2, if anyone know what the problem please see my repo on github
>> and reply me :(
>>
>> https://github.com/evilrat666/directx-d
>>
>> p.s. though xinput is fun and working :)
>
> Is there are repro case for your problem?

xaudio example is a case. it 'works', but really doesn't play anything, even if feeded data from C++, also if send ixaudiosource pointer from D to C++ crash occurs on that call https://github.com/evilrat666/directx-d/blob/master/examples/xaudio.d#L71 (if i remember correctly).
October 29, 2013
I already found the first problem with your library.
Your directx modules have module declarations in the form of:

module directx.xaudio2;

but they are directly within the src directory.
You should create a subfolder called "directx" and place all your modules in there so it is actually consistent with the module declarations.

-- 
Kind Regards
Benjamin Thaut
October 29, 2013
On Tuesday, 29 October 2013 at 13:35:11 UTC, Benjamin Thaut wrote:
> I already found the first problem with your library.
> Your directx modules have module declarations in the form of:
>
> module directx.xaudio2;
>
> but they are directly within the src directory.
> You should create a subfolder called "directx" and place all your modules in there so it is actually consistent with the module declarations.

yep, i know, thats just because it was a bit messy and i cleaned without test compile :(

btw, i think the real problem with xaudio2 is that it is part of windows, so on my machine (win 7 x64) i can't link directly(and in C++ it is actually loaded dynamically). for windows 8 there is a .lib file, but i don't have access to it now.
October 29, 2013
Am 29.10.2013 14:45, schrieb evilrat:
> On Tuesday, 29 October 2013 at 13:35:11 UTC, Benjamin Thaut wrote:
>> I already found the first problem with your library.
>> Your directx modules have module declarations in the form of:
>>
>> module directx.xaudio2;
>>
>> but they are directly within the src directory.
>> You should create a subfolder called "directx" and place all your
>> modules in there so it is actually consistent with the module
>> declarations.
>
> yep, i know, thats just because it was a bit messy and i cleaned without
> test compile :(
>
> btw, i think the real problem with xaudio2 is that it is part of
> windows, so on my machine (win 7 x64) i can't link directly(and in C++
> it is actually loaded dynamically). for windows 8 there is a .lib file,
> but i don't have access to it now.

Well I just managed to finally compile your example. And it does not crash for me. But it doesn't play a sound either.

-- 
Kind Regards
Benjamin Thaut
October 29, 2013
Am 29.10.2013 15:00, schrieb Benjamin Thaut:
> Am 29.10.2013 14:45, schrieb evilrat:
>> On Tuesday, 29 October 2013 at 13:35:11 UTC, Benjamin Thaut wrote:
>>> I already found the first problem with your library.
>>> Your directx modules have module declarations in the form of:
>>>
>>> module directx.xaudio2;
>>>
>>> but they are directly within the src directory.
>>> You should create a subfolder called "directx" and place all your
>>> modules in there so it is actually consistent with the module
>>> declarations.
>>
>> yep, i know, thats just because it was a bit messy and i cleaned without
>> test compile :(
>>
>> btw, i think the real problem with xaudio2 is that it is part of
>> windows, so on my machine (win 7 x64) i can't link directly(and in C++
>> it is actually loaded dynamically). for windows 8 there is a .lib file,
>> but i don't have access to it now.
>
> Well I just managed to finally compile your example. And it does not
> crash for me. But it doesn't play a sound either.
>

I also found that for all pp members which take pointers to COM interfaces. For example the "CreateMasteringVoice" "IXAudio2MasteringVoice** ppMasteringVoice" member. In D interfaces are already reference types. So it should read "IXAudio2MasteringVoice* ppMasteringVoice". Then you can also avoid the ugly casting you do in your examples. When fixing this it still doesn't work however.

As I'm not familiar with xaudio2 I will not be able to help you unless you present a example which actually crashes. I don't think this is a COM issue. Does a C++ program which does the same work?

Kind Regards
Benjamin Thaut
-- 
Kind Regards
Benjamin Thaut