How to disable thread local storage in Visual Studio?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
Ycep
Member
Member
Posts: 401
Joined: Mon Dec 28, 2015 11:11 am

How to disable thread local storage in Visual Studio?

Post by Ycep »

This question may not be appropriate for this forum... But it's still related to OS development.
I get:

Code: Select all

syscall.obj : error LNK2001: unresolved external symbol __Init_thread_header
syscall.obj : error LNK2001: unresolved external symbol __Init_thread_footer
syscall.obj : error LNK2001: unresolved external symbol __Init_thread_epoch
syscall.obj : error LNK2001: unresolved external symbol __tls_array
syscall.obj : error LNK2001: unresolved external symbol __tls_index
I could not find anything on Google neither in the project settings.
I would actually define these myself if I knew what they even actually are (e.g. are they functions, variables, etc.) and leave them empty.

Strangely, it happens every time I try to use C++ "static" and my solution to this problem was simply avoiding it.
simeonz
Member
Member
Posts: 360
Joined: Fri Aug 19, 2016 10:28 pm

Re: How to disable thread local storage in Visual Studio?

Post by simeonz »

Do you mean global or local static? For local static I suspect it may be the thread-safe local static initialization in C++11. It requires synchronization such as userland mutex to be implemented, and it might rely on thread local storage. The compiler option to suppress the conformance in this regard is "/Zc:threadSafeInit-".
Post Reply