Search code examples
visual-studiodlldirectxdirectx-9

How to make my application load the right d3d9* dll


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?


Solution

    1. Add DXSDK_DIR=C:\Program Files (x86)\Microsoft DirectX SDK (June 2010) to environment
    2. Add both "%DXSDK_DIR%\Developer Runtime\x86" and "%DXSDK_DIR%\Developer Runtime\x64" to system PATH variable.
    3. Use DirectX Control Panel (%DXSDK_DIR%\Utilities\bin\x86\dxcpl.exe and %DXSDK_DIR%\Utilities\bin\x64\dxcpl.exe) to enable debug runtime
    4. #define D3D_DEBUG_INFO in your code before DirectX includes
    5. If you're on Windows that is newer that Windows 7, you'll be unable to switch to debug runtime in DirectX Control Panel. You can try to set registry flags manually there: HKEY_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: