Reputation: 3106
I've installed the June 2010 Direct X SDK and written a simple DX application.
I've set the right header include and library include paths, i.e., they point to
C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include
C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x86
Everything builds fine, but when I run the application, I noticed that the d3d* modules being loaded are C:\Windows\SysWOW64\d3d9.dll
& C:\Windows\SysWOW64\d3dx9d_43.dll
I was under the assumption that linking with libs in the DirectX SDK directory will ensure that the dlls in the SDK, i.e., C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Developer Runtime\x86
would be loaded.
I'm not sure if its related to this, but my application ends up getting a NULL
device handle.
How can I ensure the right DLLs are loaded?
Upvotes: 1
Views: 2713
Reputation: 8727
About System32 and SysWOW64
The 'System32' folder is for 64-bit files and the 'SysWOW64' folder is for 32-bit files
it sounds confused, especially for the folder name, this is due to the backward comparability. please read The 'Program Files (x86)' and 'SysWOW64' folders explained for details.
So the fact is that you are building a 32 bit DirectX app on a 64 bit Windows. it will use the 32bit dlls from SysWOW64.
I'm not sure if its related to this, but my application ends up getting a NULL device handle
I am sure this is nothing related to the dll bits, you should check the return value of CreateDevice function to see what happened.
How to make my application load the right dll?
I don't think you need to do that yourself, the system will handle that for you most of the case, if you really want to do it yourself, take a look at Dynamic-Link Library Search Order.
Related posts on SO
Why do 64-bit DLLs go to System32 and 32-bit DLLs to SysWoW64 on 64-bit Windows?
How can I test a Windows DLL file to determine if it is 32 bit or 64 bit?
Upvotes: 1
Reputation: 13003
DXSDK_DIR=C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)
to environment"%DXSDK_DIR%\Developer Runtime\x86"
and "%DXSDK_DIR%\Developer Runtime\x64"
to system PATH
variable. %DXSDK_DIR%\Utilities\bin\x86\dxcpl.exe
and %DXSDK_DIR%\Utilities\bin\x64\dxcpl.exe
) to enable debug runtime#define D3D_DEBUG_INFO
in your code before DirectX includesHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Direct3D
and there HKEY_CURRENT_USER\SOFTWARE\Microsoft\Direct3D
. But most likely it will not work (on Windows that is newer that Windows 7), because DirectX 9 was deprecated a while ago, and recently some updates broke all the old stuff (even good ol' PIX). I've heard of one more option: use checked version of Windows, but didn't tried it.Good luck with it!
References:
Upvotes: 1