Compiler Warning (level 1) C4794
Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

Compiler Warning (level 1) C4794

segment of thread local storage variable 'variable' changed from 'section name' to '.tls$'

You used #pragma data_seg to put a tls variable in a section not starting with .tls$. For example:

// C4794a.cpp
// compile with: /W1 /LD
#pragma data_seg(".someseg")
__declspec(thread) int i; // C4794

Instead, use something similar to this:

// C4794b.cpp
// compile with: /LD
#pragma data_seg(".tls$9")
__declspec(thread) int i;

The .tls$x section will exist in the object file where __declspec(thread) variables are defined. A .tls section in the EXE or DLL will result from these sections.

© 2016 Microsoft