title: about TLS Callback in windows
body: <p>this is the test code </p>
  
  <pre><code>#include "windows.h"
  #include "iostream"
  using namespace std;
  
  __declspec(thread) int tls_int = 0;
  
  void NTAPI tls_callback(PVOID, DWORD dwReason, PVOID)   
  {
      tls_int = 1;
  }
  
  #pragma data_seg(".CRT$XLB")
  PIMAGE_TLS_CALLBACK p_thread_callback = tls_callback;
  #pragma data_seg()
  
  int main()
  {
      cout&lt;&lt;"main thread tls value = "&lt;&lt;tls_int&lt;&lt;endl;
  
      return 0;
  }
  </code></pre>
  
  <p>build with Multi-threaded Debug DLL (/MDd)
  run result : main thread tls value = 1</p>
  
  <p>build with Multi-threaded Debug (/MTd)
  run result : main thread tls value = 0</p>
  
  <p>Looks like can not capture the main thread created when use the MTd</p>
  
  <p>why ?</p>