Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm developing an application that utilizes DX11. I know that DX11 is only available on Windows 7 (and Vista with SP). I wonder if there is some way to run the application on Windows XP and use only the old DX9? I need to prevent the loading of DX11 dlls when on Windows XP. How can this be done?

I've got an old renderer, that runs entirely on DX9 and a new renderer that uses DX11. My idea is to run the old renderer underr Windows XP and load only DX9 dlls, and to run the new renderer on Windows Vista / 7 and load DX11 stuff as well.

I've heard about a LoadLibrary() function that loads libraries at runtime. So far I have my Visual Studio project with all that DX11 .lib files in Additional Dependecies. How should I change this to load it completely at runtime? Do I need to define all symbols in DX11 .dlls manually?

share|improve this question
    
I've tried delayed load of DX11 dlls (by manually adding those dll filenames to Delayed Loaded DLLs in VS). But some dlls are versioned (D3DCompiler_43.dll) and I don't want to put the versioned name there, because if the version of DX11 changes, it would not work at all. –  GPUquant Jan 21 '13 at 11:15
    
And what happens if you specify D3DCompiler.dll instead of D3DCompiler_43.dll? –  Laurent Couvidou Jan 21 '13 at 11:22
    
Or if you don't put it at all? I suspect that this could be unnecessary, especially if you use D3DX and not the D3DCompiler directly. –  Laurent Couvidou Jan 21 '13 at 11:39
    
Effect framework seems to be using it directly. If I remove the D3DCompiler import, I get 2 unresolved external symbols... –  GPUquant Jan 21 '13 at 11:48
    
That's if you don't link against the .lib. You can leave that, this lib is common to all versions of DirectX. See there for details. And if your concerned about this version number in the DLL, then don't do delayed loading on it. –  Laurent Couvidou Jan 21 '13 at 12:03

1 Answer 1

up vote 2 down vote accepted

If you use the /delayload linker switch, it is safe to link your application against DX11 .libs and run it under Windows XP, as long as you do not call any DX11 function at runtime. This is equivalent to using LoadLibrary and GetProcAddress, except that it is far more convenient: no need to go for the old-fashioned way.

This is for instance what the UDK is doing. Make sure that you check the OS version before you create your renderer, and only use the appropriate DirectX version afterwards.

Another common option is to use different executables, one for DX9, and another for DX11. This is way simpler to setup, but to stay user-friendly this requires a separate launcher that tests the OS version before running the right exe.

share|improve this answer
    
but /delayload works just for mentioned dlls (/delayload:d3dx11.dll). I've several dlls that I want to load at startup and only those DX11 dlls to load on demand. So I add /delayload for every DX11 related dll. This seems to work, but I'm not sure if this is good solution, because I need to fill even the versioned dll names (like D3DCompiler_43.dll) –  GPUquant Jan 21 '13 at 14:01
    
@GPUquant See my comment above, I don't think you should bother about this one. It's shared between DX9 and DX11, so it won't give you any trouble. And to my knowledge this is the best solution if you want to keep a common exe. –  Laurent Couvidou Jan 21 '13 at 14:37
    
Yes, but my point was, that I don't want to update this every time I change DX SDK version (d3dx11_43.dll will change to e.g. d3dx11_44.dll). In the lib is defined which dll to load. So I was looking for some automated solution. But I accept your solution. Thanks! –  GPUquant Jan 22 '13 at 12:41
    
@GPUquant Hmm I see. Well I guess that would be a good candidate for a new question ;) –  Laurent Couvidou Jan 22 '13 at 13:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.