There's a large number of versions of the D3DX dll, from each SDK update, each version having a unique name (list of D3DX dll names).

All-too-often, people have versions missing. So even though they have a compatible version of DirectX, your D3D-based project won't run on their machine.

I want to be able to distribute games (little spare-time projects, game jam entries, etc) as a simple zip file, without the need for an installer. But a significant percentage of users run into missing D3DX .dll errors. And without an installer, Microsoft's official solution (the DirectX web installer/updater) isn't really much of a solution.

Unfortunately, Microsoft still won't give us the option of static linking to D3DX (which would be a nice clean solution). And avoiding using D3DX isn't very practical, especially if you're working with shaders (and no, I'm not switching to OpenGL, at least for now)

Does anyone have clever solutions to avoiding this DLL hell?

  • 2
    \$\begingroup\$ Might get better responses from Stack Overflow (stackoverflow.com) - even though this applies to your games it's really programming. In the meantime... Can you not just put the DLLs in the same folder as your executable? \$\endgroup\$
    – Ricket
    Commented Jan 29, 2011 at 20:36
  • \$\begingroup\$ Hmmm... would it be a silly idea to revert to the oldest possible DX9 SDK version I can get hold of, just to reduce this problem? Seems a crazy way of doing things, but MS has really created an annoying problem here. Another equally crazy option would be to re-implement the most important D3DX functionality from scratch, but I don't fancy re-inventing the Effects system... \$\endgroup\$
    – bluescrn
    Commented Jan 29, 2011 at 22:46
  • \$\begingroup\$ In the recent SDKs (as of some time last year I think) the effect subsystem was largely moved out of the core and D3DX SDKs for 10+. You can compile it yourself, in fact -- the code is in the SDK and is redistributable (as are the binaries produced from it). It is probably easier to back port the system to work with 9, and most of the rest of D3DX is pretty easy to re-implement or find alternatives for. \$\endgroup\$
    – user1430
    Commented Jan 30, 2011 at 0:16
  • 2
    \$\begingroup\$ Don't use d3dx. Its not nearly as fast/good/efficient/cool anyways. \$\endgroup\$
    – stefan
    Commented Jan 30, 2011 at 6:58
  • \$\begingroup\$ I could pass on the DirectX maths, mesh, texture, and general helper stuff - but can't really give up D3DXEffect. And I'm stuck with DX9 more-or-less forever. And as far as I'm concerned, DX10+ don't exist, because they don't exist on XP \$\endgroup\$
    – bluescrn
    Commented Jan 30, 2011 at 10:30

2 Answers 2


Unfortunately, there isn't a good, legal solution for this except to make an installer, because your hands are tied by the distribution rights granted to you by the DirectX SDK, which provides the D3DX DLLs. Under the terms of the license agreement you are bound to by using the SDK (which is located in (SDK Install Directory)/Documentation/License Agreements/ you are only permitted to redistribute the binary forms of certain subsets of the SDK, along with some of the sample and utility code.

As of the June 2010 SDK, you allowed to redistribute anything in the "Redist" directory and when doing so you must include certain components (DSetup32.dll, DSetup.dll, DXSetup.exe, DXupdate.cab and dxdllreg_x86.cab). The Redist directory includes the .cab files for the D3DX DLLs, but not the DLLs themselves so you are out of luck.

It isn't terribly hard to build an installer, fortunately, that just runs the appropriate D3DX web installer or whatnot that is something you redistribute. Simple .msi installers are just as easy for a user to use (double-clicking is generally all that's needed) and can be configured to allow installation into arbitrary directories, if you are concerned for some reason about "polluting" the Program Files directory with these small throw-away programs. The overhead in download size of an appropriately configured installer can be quite small, as well, so that shouldn't be too much of a problem.

EDIT: Here is a good page about DX installation stuff.

EDIT 2: Struck out the "web" bit in response to a correction in the comments.

  • 3
    \$\begingroup\$ You're not allowed to redistribute the web installer, just point them to the microsoft.com page (so not ideal), And the redistributable components are a minimum of 3Mb (insignificant compared to the size of a 'real game', but not for little spare-time projects) \$\endgroup\$
    – bluescrn
    Commented Jan 29, 2011 at 22:42
  • \$\begingroup\$ Er, yup, you're right, I misspoke about the web installer. \$\endgroup\$
    – user1430
    Commented Jan 29, 2011 at 23:12

Four main solutions spring to mind.

First one is to use an older version of the DirectX SDK. I seem to remember that versions from roundabout 2004 or earlier were statically linked (but if a larger executable size frightens you that might not be an option), and it's also the case that if you use a version from 2006/2007 or earlier then the D3DX DLLs you need will stand a much higher chance on being on the machine. Downside of this is that you'll be missing out on bugfixes, performance enhancements and improved functionality in the newer SDKs (it also rules out any version of D3D other than 9).

Second solution is to use LoadLibrary and GetProcAddress on the D3DX functions. You pick a maximum and minimum supported version (say, from _42 to _34), then go into a loop from max to min, construct the DLL name, and attempt to LoadLibrary it. If you load it OK, you then do a bunch of GetProcAddress calls and use your function pointers instead of the raw D3DX functions. Kind of like OpenGL extensions, if you know what I'm talking about. This one's potentially a little hairy, and you might still have to deal with the case where you can't find any DLL in your range. But I have used this one in the past and it works well enough.

Third solution is to just not use D3DX. Might be an option in some cases, might not be an option in your case.

Fourth and final solution is to just tell your users to upgrade their Direct 3D. They really should be doing this anyway, it's a small and fast download from Microsoft, and it's an instant problem solver. Your users may not like to have to do so, and you may have to deal with questions like "I've already got D3D11, why do I need to upgrade my D3D9", but on balance it may work out more economical overall to take it on the nose.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .