E2190 Thread local variables cannot be ABSOLUTE (Delphi)

From RAD Studio
Jump to: navigation, search

Go Up to Error and Warning Messages (Delphi)

A thread local variable cannot refer to another variable, nor can it reference an absolute memory address.


program Produce;

  threadvar
     secretNum : integer absolute $151;

begin
end.

The absolute directive is not allowed in a threadvar declaration section.


program Solve;

  threadvar
    secretNum : integer;

  var
    sNum : integer absolute $151;

begin
end.

There are two easy ways to solve a problem of this nature. The first is to remove the absolute directive from the threadvar section. The second would be to move the absolute variable to a normal var declaration section.