c++windows-10-universalc++-cxthread-local-storagewack

UWP Windows-10: How to use Thread Local Storage api's in Store apps


I have a C# app targeting Windows-10 Desktop & Mobile platforms. My app calls in to Windows Runtime Component written in C++ with c++/cx bindings.
My C++ code uses Thread Local Storage api's like TlsAlloc, TlsGetValue, TlsSetValue and TlsFree. When I run Windows App Certification Kit Tests (WACK tests), it complains about unavailability of these api, in the store app's.

◦API TlsAlloc in kernel32.dll is not supported for this application type. sample.dll calls this API.
◦API TlsFree in kernel32.dll is not supported for this application type. sample.dll calls this API.
◦API TlsGetValue in kernel32.dll is not supported for this application type. sample.dll calls this API.
◦API TlsSetValue in kernel32.dll is not supported for this application type. sample.dll calls this API.

I couldnt see alternatives for these api's for Windows-10 store app's. This MSDN page only talks about these api's availability on Windows Phone 8. I couldnt find any specific info regarding these api's for Windows-10

I am compiling my native C++ libs using -DWINAPI_FAMILY=WINAPI_FAMILY_APP flag

Any suggestions will be highly appreciated


Solution

  • @HansPassant answer helped to figure this out.

    Thread Local Storage(TLS) api's are supported in UWP Windows-10 Store apps.
    I had to upgrade to Windows SDK version 10.0.14393.33
    Any version prior to this will error out on TLS api's