[fpc-devel] threadvar implementation

Michael Schnell mschnell at lumino.de
Mon Jul 26 13:43:34 CEST 2010


  M$ C on Win32 (X86/32), using Visual Studio.



declspec(thread) int ithread;

   ithread = 1;


results in

  mov eax, dword ptr [__tls_index (417328h) ]
  mov ecx, dword ptr fs:[2Ch]
  mov edx, dword ptr [ecx,+eax*4]
  mov dword pth[edx+104h],1

This is essentially the same code as with Delphi. Supposedly as with 
Delphi [__tls_index (417328h) ] is always 0 with normal applications. 
(no idea what this is useful for)

-Michael





More information about the fpc-devel mailing list