about TLS Callback in windows

前端 未结 2 686
鱼传尺愫
鱼传尺愫 2021-01-02 21:07

this is the test code

#include \"windows.h\"
#include \"iostream\"
using namespace std;

__declspec(thread) int tls_int = 0;

void NTAPI tls_callback(PVOID,         


        
2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-02 21:23

    You also must explicitly add the symbol __tls_used. With this your code should work:

    #pragma comment(linker,"/include:__tls_used")
    

提交回复
热议问题