www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - directx bindings problem

reply "evilrat" <evilrat666 gmail.com> writes:
i'm trying directx bindings from dsource 
(http://dsource.org/projects/bindings/wiki/DirectX)
and encountered problem, when calling swap chain getbuffer it 
suddenly crashes. does anyone using it? any help please :(

// Create a render target view
ID3D11Texture2D* pBackBuffer;
	
// C++ version
//hr = g_pSwapChain->GetBuffer( 0, __uuidof( ID3D11Texture2D 
),(LPVOID*)&pBackBuffer );

// D version(crashes)
hr = g_pSwapChain.GetBuffer( 0, &IID_ID3D11Texture2D, 
cast(LPVOID*)pBackBuffer );
Oct 02 2013
next sibling parent reply Benjamin Thaut <code benjamin-thaut.de> writes:
Am 03.10.2013 08:19, schrieb evilrat:
 i'm trying directx bindings from dsource
 (http://dsource.org/projects/bindings/wiki/DirectX)
 and encountered problem, when calling swap chain getbuffer it suddenly
 crashes. does anyone using it? any help please :(

 // Create a render target view
 ID3D11Texture2D* pBackBuffer;

 // C++ version
 //hr = g_pSwapChain->GetBuffer( 0, __uuidof( ID3D11Texture2D
 ),(LPVOID*)&pBackBuffer );

 // D version(crashes)
 hr = g_pSwapChain.GetBuffer( 0, &IID_ID3D11Texture2D,
 cast(LPVOID*)pBackBuffer );
What directX .lib file are you linking against? Whats the exact error that is given to you? When you run this from within visual studio you might get additional information about the problem. Kind Regards Bejamin Thaut
Oct 03 2013
parent reply "evilrat" <evilrat666 gmail.com> writes:
On Thursday, 3 October 2013 at 09:35:46 UTC, Benjamin Thaut wrote:
 Am 03.10.2013 08:19, schrieb evilrat:
 i'm trying directx bindings from dsource
 (http://dsource.org/projects/bindings/wiki/DirectX)
 and encountered problem, when calling swap chain getbuffer it 
 suddenly
 crashes. does anyone using it? any help please :(

 // Create a render target view
 ID3D11Texture2D* pBackBuffer;

 // C++ version
 //hr = g_pSwapChain->GetBuffer( 0, __uuidof( ID3D11Texture2D
 ),(LPVOID*)&pBackBuffer );

 // D version(crashes)
 hr = g_pSwapChain.GetBuffer( 0, &IID_ID3D11Texture2D,
 cast(LPVOID*)pBackBuffer );
What directX .lib file are you linking against? Whats the exact error that is given to you? When you run this from within visual studio you might get additional information about the problem. Kind Regards Bejamin Thaut
d3dcompiler.lib, d3d11.lib, dxgi.lib i can't get any details on it, as it seems to be somewhere inside DirectX C++ part. i was thinking this is GUID problem, so i'd tried using IIDFromString on D3D11Texture2d GUID to get actual value with no luck(it always report invalid args).
Oct 03 2013
parent reply Benjamin Thaut <code benjamin-thaut.de> writes:
Am 03.10.2013 11:57, schrieb evilrat:
 On Thursday, 3 October 2013 at 09:35:46 UTC, Benjamin Thaut wrote:
 Am 03.10.2013 08:19, schrieb evilrat:
 i'm trying directx bindings from dsource
 (http://dsource.org/projects/bindings/wiki/DirectX)
 and encountered problem, when calling swap chain getbuffer it suddenly
 crashes. does anyone using it? any help please :(

 // Create a render target view
 ID3D11Texture2D* pBackBuffer;

 // C++ version
 //hr = g_pSwapChain->GetBuffer( 0, __uuidof( ID3D11Texture2D
 ),(LPVOID*)&pBackBuffer );

 // D version(crashes)
 hr = g_pSwapChain.GetBuffer( 0, &IID_ID3D11Texture2D,
 cast(LPVOID*)pBackBuffer );
What directX .lib file are you linking against? Whats the exact error that is given to you? When you run this from within visual studio you might get additional information about the problem. Kind Regards Bejamin Thaut
d3dcompiler.lib, d3d11.lib, dxgi.lib i can't get any details on it, as it seems to be somewhere inside DirectX C++ part. i was thinking this is GUID problem, so i'd tried using IIDFromString on D3D11Texture2d GUID to get actual value with no luck(it always report invalid args).
NO I mean are you sure the library paths are correctly set to the "June 2010 DirectX SDK/lib" path? Do you use 32 or 64 bit? You can get details on crashes inside DirectX by using the microsoft symbol server: http://support.microsoft.com/kb/311503 (assuming you use the microsoft debugger of course) Kind Regards Benjamin Thaut
Oct 03 2013
parent reply "evilrat" <evilrat666 gmail.com> writes:
On Thursday, 3 October 2013 at 10:08:42 UTC, Benjamin Thaut wrote:
 NO I mean are you sure the library paths are correctly set to 
 the "June 2010 DirectX SDK/lib" path?
all paths are set correctly.
 Do you use 32 or 64 bit?
32 bit.
 You can get details on crashes inside DirectX by using the 
 microsoft symbol server: http://support.microsoft.com/kb/311503 
 (assuming you use the microsoft debugger of course)
i'm using visual studio debugger, maybe i should try this. but as i said it looks like guid problem.
Oct 03 2013
parent reply Benjamin Thaut <code benjamin-thaut.de> writes:
Am 03.10.2013 12:47, schrieb evilrat:
 On Thursday, 3 October 2013 at 10:08:42 UTC, Benjamin Thaut wrote:
 NO I mean are you sure the library paths are correctly set to the
 "June 2010 DirectX SDK/lib" path?
all paths are set correctly.
 Do you use 32 or 64 bit?
32 bit.
 You can get details on crashes inside DirectX by using the microsoft
 symbol server: http://support.microsoft.com/kb/311503 (assuming you
 use the microsoft debugger of course)
i'm using visual studio debugger, maybe i should try this. but as i said it looks like guid problem.
If you think it is a guid problem you could just open the c++ header lookup the GUID and compare it to the one in derlict
Oct 03 2013
parent "evilrat" <evilrat666 gmail.com> writes:
On Thursday, 3 October 2013 at 11:21:14 UTC, Benjamin Thaut wrote:
 Am 03.10.2013 12:47, schrieb evilrat:
 On Thursday, 3 October 2013 at 10:08:42 UTC, Benjamin Thaut 
 wrote:
 NO I mean are you sure the library paths are correctly set to 
 the
 "June 2010 DirectX SDK/lib" path?
all paths are set correctly.
 Do you use 32 or 64 bit?
32 bit.
 You can get details on crashes inside DirectX by using the 
 microsoft
 symbol server: http://support.microsoft.com/kb/311503 
 (assuming you
 use the microsoft debugger of course)
i'm using visual studio debugger, maybe i should try this. but as i said it looks like guid problem.
If you think it is a guid problem you could just open the c++ header lookup the GUID and compare it to the one in derlict
this is not derelict, it's old directx bindings that was part of winapi bindings i think.
Oct 03 2013
prev sibling next sibling parent reply Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
On 10/3/13, evilrat <evilrat666 gmail.com> wrote:
 // Create a render target view
 ID3D11Texture2D* pBackBuffer;
 	
 // C++ version
 //hr = g_pSwapChain->GetBuffer( 0, __uuidof( ID3D11Texture2D
 ),(LPVOID*)&pBackBuffer );

 // D version(crashes)
 hr = g_pSwapChain.GetBuffer( 0, &IID_ID3D11Texture2D,
 cast(LPVOID*)pBackBuffer );
You're passing a null pointer (pBackBuffer). You should try this: ID3D11Texture2D backBuffer; hr = g_pSwapChain.GetBuffer( 0, &IID_ID3D11Texture2D, cast(LPVOID*)&backBuffer );
Oct 03 2013
parent "evilrat" <evilrat666 gmail.com> writes:
On Thursday, 3 October 2013 at 11:30:58 UTC, Andrej Mitrovic 
wrote:
 On 10/3/13, evilrat <evilrat666 gmail.com> wrote:
 // Create a render target view
 ID3D11Texture2D* pBackBuffer;
 	
 // C++ version
 //hr = g_pSwapChain->GetBuffer( 0, __uuidof( ID3D11Texture2D
 ),(LPVOID*)&pBackBuffer );

 // D version(crashes)
 hr = g_pSwapChain.GetBuffer( 0, &IID_ID3D11Texture2D,
 cast(LPVOID*)pBackBuffer );
You're passing a null pointer (pBackBuffer). You should try this: ID3D11Texture2D backBuffer; hr = g_pSwapChain.GetBuffer( 0, &IID_ID3D11Texture2D, cast(LPVOID*)&backBuffer );
this not works too(actually it would never be, because this is just interface). what i'm trying to do is what works on c++ just fine, so that texture should be null. actually now i'm think this bindings too outdated, or there is some ABI mismatch which i can't find out now... either way, i think creating a custom binding would be the best way. thanks for help anyway.
Oct 03 2013
prev sibling next sibling parent reply "evilrat" <evilrat666 gmail.com> writes:
On Thursday, 3 October 2013 at 06:19:27 UTC, evilrat wrote:
 i'm trying directx bindings from dsource 
 (http://dsource.org/projects/bindings/wiki/DirectX)
 and encountered problem, when calling swap chain getbuffer it 
 suddenly crashes. does anyone using it? any help please :(

 // Create a render target view
 ID3D11Texture2D* pBackBuffer;
 	
 // C++ version
 //hr = g_pSwapChain->GetBuffer( 0, __uuidof( ID3D11Texture2D 
 ),(LPVOID*)&pBackBuffer );

 // D version(crashes)
 hr = g_pSwapChain.GetBuffer( 0, &IID_ID3D11Texture2D, 
 cast(LPVOID*)pBackBuffer );
well, after some research i can state that those bindings sucks. (is this actually bidings and not simply find & replace on C++ header?) 1) they declare C++ double ptr (i.e. void**) as plain D "out"!!! 2) this bindings handles C++ const &struct just declaring it as pointer!!!11!1 (or maybe i'm so noob?) and finally, 3) i hate how author handled enums...(just personal opinion) omg i need to fully rewrite this and add wrapper for C++ const ref before it would be even usable... i'll post again when i do something. thanks for attention everyone.
Oct 05 2013
parent reply "evilrat" <evilrat666 gmail.com> writes:
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 ...
Oct 05 2013
parent reply Benjamin Thaut <code benjamin-thaut.de> writes:
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?
Oct 06 2013
parent "evilrat" <evilrat666 gmail.com> writes:
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?
Oct 06 2013
prev sibling parent reply "evilrat" <evilrat666 gmail.com> writes:
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 :)
Oct 29 2013
parent reply Benjamin Thaut <code benjamin-thaut.de> writes:
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?
Oct 29 2013
parent reply "evilrat" <evilrat666 gmail.com> writes:
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).
Oct 29 2013
parent reply Benjamin Thaut <code benjamin-thaut.de> writes:
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
Oct 29 2013
parent reply "evilrat" <evilrat666 gmail.com> writes:
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.
Oct 29 2013
parent reply Benjamin Thaut <code benjamin-thaut.de> writes:
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
Oct 29 2013
parent reply Benjamin Thaut <code benjamin-thaut.de> writes:
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
Oct 29 2013
next sibling parent "evilrat" <evilrat666 gmail.com> writes:
On Tuesday, 29 October 2013 at 14:13:40 UTC, Benjamin Thaut wrote:
 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?
C++ example works fine(link to original in xaudio example comments). thats just D port issues.
Oct 29 2013
prev sibling parent reply "evilrat" <evilrat666 gmail.com> writes:
On Tuesday, 29 October 2013 at 14:13:40 UTC, Benjamin Thaut wrote:
 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.
i have removed unneeded ptr-to-ptr in args, still doesn't works. but, maybe you can tell something about this code? //---------------------------- class XACallbacks : ComObject, IXAudio2EngineCallback { extern(Windows): void OnProcessingPassStart() {} void OnProcessingPassEnd () {} void OnCriticalError (HRESULT Error) { writeln(Error); } } ... XACallbacks xcb = new XACallbacks (); XAudio2Create( g_engine, XAUDIO2_DEBUG_ENGINE ); g_engine.RegisterForCallbacks(xcb); // <- after setting this callback crashes on any call later, probably stack corruption ... //----------------------------
Oct 29 2013
next sibling parent "Heinz" <thor587 yahoo.com> writes:
I have the exact same problem with XAudio2 in my own code. Code
compiles and run but doesn't output any sound. I tried your code
but it's the same as mine, runs but doesn't sound.

I'm using in my code the bindings from
http://www.dsource.org/projects/bindings/wiki/DirectX

Can't really understand what's going on with XAudio/COM in D2.
Oct 29 2013
prev sibling parent reply Benjamin Thaut <code benjamin-thaut.de> writes:
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
Oct 29 2013
next sibling parent reply "Heinz" <thor587 yahoo.com> writes:
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.
Oct 29 2013
parent Benjamin Thaut <code benjamin-thaut.de> writes:
Am 29.10.2013 21:26, schrieb Heinz:
 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.
The debug information are only compatible for 64-bit. But for 64-bit you will run into other problems when debugging with the visual studio debugger which require patching dmd to make it work. For 32-bit they are in a different format but can be converted using cv2pdb which is part of VisualD. You should really be using VisualD when doing anything on windows. So the best option is using 32-bit and converting the debug information (manually or using VisualD which does it automatically) if you don't want to patch the compiler. If you need 64-bit and patching the compiler is an option I might be able to put up a small how-to. COM interfaces don't need to be declared as extern(C++). Only interfaces that do not inherit from IUnkown and are actually C++ interfaces need to be declared extern(C++) Kind Regards Benjamin Thaut
Oct 29 2013
prev sibling parent reply "evilrat" <evilrat666 gmail.com> writes:
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.
omg! i can't believe this :( i have tried this too first(http://www.dsource.org/projects/bindings/wiki/DirectX), and it was somewhat crappy, so i start my own tranlation, all was fine until xaudio2. i looked up what author of those bindings did, noticed that it doesn't exactly relates to xaudio2.h, and tried to make the same in my version. so it figures out i have just overlooked that its not a COM interfaces. big thanks to you, i feel stupid :( now i need to fix my xaudio, and then i can clean d3d11 mess i made.
Oct 29 2013
parent reply Benjamin Thaut <code benjamin-thaut.de> writes:
Am 30.10.2013 04:18, schrieb evilrat:
 On Tuesday, 29 October 2013 at 19:40:40 UTC, Benjamin Thaut wrote:

 omg! i can't believe this :(

 i have tried this too
 first(http://www.dsource.org/projects/bindings/wiki/DirectX), and it was
 somewhat crappy, so i start my own tranlation, all was fine until
 xaudio2. i looked up what author of those bindings did, noticed that it
 doesn't exactly relates to xaudio2.h, and tried to make the same in my
 version. so it figures out i have just overlooked that its not a COM
 interfaces. big thanks to you, i feel stupid :(

 now i need to fix my xaudio, and then i can clean d3d11 mess i made.
Well we all make problems. Give me a note when you are done with complete directx bindings as I'm also interrested in having minimal up to date directx bindings. Also its always apperciated to thank you a person which invested multiple hours to track down _your_ problem. -- Kind Regards Benjamin Thaut
Oct 30 2013
parent reply "evilrat" <evilrat666 gmail.com> writes:
On Wednesday, 30 October 2013 at 15:18:57 UTC, Benjamin Thaut 
wrote:
 Well we all make problems. Give me a note when you are done 
 with complete directx bindings as I'm also interrested in 
 having minimal up to date directx bindings.

 Also its always apperciated to thank you a person which 
 invested multiple hours to track down _your_ problem.
yes, thanks again. i just really do prefer to solve my problems without bothering people around. what exactly parts of DirectX you are interested in? my plans was to provide bindings for d3d11, xaudio2, x3daudio, xinput), d3d11 shader compiler and stuff, and maybe d3d10. (though i'm not sure about this, d3d11 is newer and cleaner and can utilize d3d 9-to-11 gpu's). and at last directxmath.h, but i don't know if it's possible to hack just one layer of C++ namespace with current extern(C++). but if its not possible i wish to avoid asm sections with SIMD(or maybe i can use phobos SIMD instrinsics, never tried it before) to provide same API as DirectXMath.
Oct 30 2013
parent Benjamin Thaut <code benjamin-thaut.de> writes:
Am 30.10.2013 17:53, schrieb evilrat:
 On Wednesday, 30 October 2013 at 15:18:57 UTC, Benjamin Thaut wrote:
 Well we all make problems. Give me a note when you are done with
 complete directx bindings as I'm also interrested in having minimal up
 to date directx bindings.

 Also its always apperciated to thank you a person which invested
 multiple hours to track down _your_ problem.
yes, thanks again. i just really do prefer to solve my problems without bothering people around. what exactly parts of DirectX you are interested in? my plans was to provide bindings for d3d11, xaudio2, x3daudio, xinput), d3d11 shader compiler and stuff, and maybe d3d10. (though i'm not sure about this, d3d11 is newer and cleaner and can utilize d3d 9-to-11 gpu's). and at last directxmath.h, but i don't know if it's possible to hack just one layer of C++ namespace with current extern(C++). but if its not possible i wish to avoid asm sections with SIMD(or maybe i can use phobos SIMD instrinsics, never tried it before) to provide same API as DirectXMath.
I'm mostly interrested in directx 11 and d3d11 shader compiler bindings. I don't really need any other part of the directx api (maybe xaudio2 in the future, currently I'm using OpenAL for sound) I already have my own math classes implemented in D so I don't really need DirectXMath. Also D compilers will not be able to inline stuff that comes in from C++. D's SIMD intrinsics (core.simd) are unusable at the momemnt, so I would avoid them. The simd intrinsics of LDC and GDC work however (__builtin_x stuff). -- Kind Regards Benjamin Thaut
Oct 30 2013