We are producing a DLL that is targeted at both Windows 7 and XP. We want our DLL to use the newer Vista Thread Pool API when the DLL is loaded on a Windows 7 system and not when it is loaded on an XP system.
Right now, we tried compiling the DLL with runtime detection of the OS to make sure the Vista API is never used on an XP system, but we still cannot register our DLL on a Windows XP system because of a missing dependency in kernel32.dll…
Is there a way around this other than building two separate versions of the DLL?
Thanks in advance
Why don’t you dynamically load kernel32.dll using LoadLibrary and then use GetProcAddress to determine if the Vista Thread Pool API functions you need are available? If they are, fine, if they are not fall back to the older API functions.
E.g. (untested)