[fpc-devel] threadvar implementation

Michael Schnell mschnell at lumino.de
Mon Jul 26 12:50:52 CEST 2010


  As recommended starting a new message thread

Reverse engineering:

threadvar ithread: integer;
ithread := 1;

or in "C":

__thread ithread int:
ithread = 1;



Delphi, Win32 on X86/32 (stripping off additional offsets that seemingly 
are always 0 in normal applications):

  mov edx, FS: $2c
  mov eax, (edx)
  mov ithread.offset (eax), 1




gnuC Linux on X86/32

   mov eax, GS:0
   mov ithread.offset (eax), 1


more to come....
I don't have Win 64 or Linux X86/64. Maybe someone can help...

-Michael




More information about the fpc-devel mailing list