Page 1 of 1

How to disable thread local storage in Visual Studio?

Posted: Mon Jun 04, 2018 12:34 pm
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.

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

Posted: Mon Jun 04, 2018 12:52 pm
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-".