I am in desperate need of help, I need to manage an application dependency in Visual Studio. The application links to a DLL only on a specific version of windows, lets say Windows 7. and on other environments, the DLL should not be loaded. How will I be able to achieve that using DLL Delay Loading as this topic is completely new to me and there isn't any good references online for this particular matter.
Regards
Your project can specify that a dll it depends upon should but be loaded when needed, by specifying it in the Linker/Input/Delay Loaded DLLs field. This setting can be different for different build configurations.
Instead of using delay loading, have you considered using dynamic loading with
LoadLibrary
andGetProcAddress
? This is likely to be simpler to use.MSDN has a pretty good description here.
Basically what you are doing is settign the DLL in question to be in the delay load section. It will then not load that DLL until you make a call to a function that is in that DLL.
From the above link: