Do you like these nice dll-not-found surprises as much as me, when running your self created games on other PCs? Like
| The application could not be started, because d3dx9_28.dllwas not found. Reinstalling could remove the problem.
|
Of course, reinstalling won't change anything. The reason for this is that in 2005, Microsoft has moved the D3DX library from a static linked lib to a dynamic linked dll. Every time they release a new version (almost every two months), they increase the version number and the name of the dll is different (d3dx9_24.dll, d3dx9_25.dll, d3dx9_26.dll, d3dx9_27.dll, ...). The problem now is that end users usually don't update their DirectX version every 2 months. Totally understandable. But usually, developers do, and so the program won't run on the end users system without a DirectX update. Ok, Dlls do have a lot of advantages but in my opinion, Microsoft really made a bad decision here. For example,
just search for d3dx9_26.dll and see how many users have a problem with that. Most applications or their installers could provide this dll too, but in fact, most don't do this, and IMO it should also not be their buisness to do that.
Maybe you also have noticed that
Irrlicht doesn't suffer from this problem. Why? Because I simply compile Irrlicht with an old SDK version which still has a staticly linkable D3DX version. But this isn't a good solution if you want to use newer versions of the DirectX SDK. How do other 3D engines solve this? Most engines simply don't. They simply won't run without all dlls installed and produce that nice senseless 'resinstall might solve the problem' message box. Others use a plugin-approach: They implement each renderer in an own dll and load it when needed. If for example the d3d renderer doesn't load because the dependency to a d3dx9_xx.dll could not be resolved, they simply don't run with the d3d renderer. But both approaches are not an option for Irrlicht. First because I want Irrlicht to start up always, independent of what the user has installed on his system, and second because I don't want Irrlicht to use plugins, everything should be compiled into one single, small dll.
But this morning, I checked in an Irrlicht version with runs with every version of D3D and independent of what the user has installed on its system. How do I achieve this? Irrlicht now simply tries to load all external dlls manually, like it did this with the standard d3d dlls before too. If you are missing the expected d3dx9_xx.dll, it simply disables the features needed from there, which in this case only is shader support, everything else like mipmap generation is implemented in Irrlicht itself and doesn't rely on D3DX. This also has some other advantages: Irrlicht won't load these unecessary dlls if you don't use their features in your program, increasing startup time a bit. Yay, I really like it now.