Raja
Raja

Reputation: 3106

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?

Upvotes: 1

Views: 2713

Answers (2)

zdd
zdd

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

Upvotes: 1

Drop
Drop

Reputation: 13003

  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:

Upvotes: 1

Related Questions