MDES SDK Guides How to provide explicit dynamic linking support for Windows XP

When and why does this fix need to be applied?

There is a known limitation when dealing with Thread Local Storage on Windows XP, which is documented here: https://support.microsoft.com/en-us/kb/118816.

While libwaapi does not explicitly use TLS, it does use C++11 functionality. Microsoft uses TLS behind-the-scenes in some of it's C++11 implementation logic, which introduces this issue.

The only integrations that require this work-around are those which are explict dynamic linking (using LoadLibrary) and need to provide Windows XP (SP3+) support. If linking implicitly against libwaapi.lib is an option then this is the preferred method and nothing else needs to be done.

How should the linking fix be applied?

To resolve the issue, all that needs to be done is to include "wa_api_xp_support.lib" into the project settings for the integrating executable. The lib can be found under the "supplemental" directory within the lib section of the package.

Any executable project that uses LoadLibrary to load "libwaapi.dll" will need to include the wa_api_xp_support.lib in the project. If another dll is loaded explicitly and that dll loads libwaapi.dll, either implicitly or explicitly, then this fix will also be necessary.

The .lib can ONLY be included through the linker options for the project. It CANNOT be included through the use of "#pragma comment" directives. This will not work as the compiler that processes the #pragma, in many cases, loads the lib incorrectly or doesn't load it at all. This is due to the particular way that the lib was crafted to create this work around.

If using Visual Studio then the .lib would generally be added to the "Configuration Properties" -> "Linker" -> "Input" -> "Additional Dependencies" or similar depending on the VS version.

What is the difference between the release and release_static versions of the XP lib?

Within the win32 or x64 directories for the supplemental libs there are both "release" and "release_static" directories. The version that needs to be used depends on how the integrating executable is linked to the Microsoft CRT.

If the executable is built with the "/MT" linker option then it is statically linking the CRT and should use the "release_static" version of "wa_api_xp_support.lib."

If the executable is built with the "/MD" linker option then it is dynamically linking the CRT and should use the "release" version of "wa_api_xp_support.lib."