E2111 Cannot add or subtract relocatable symbols (Delphi)

From RAD Studio
Jump to: navigation, search

Go Up to Error and Warning Messages (Delphi)

The inline assembler is not able to add or subtract memory address which may be changed by the linker.


program Produce;

  var
    a : array [1..10] of Integer;
    endOfA : Integer;

  procedure Relocatable;
  begin
  end;

  procedure Assembly;
  asm
    mov eax, a + endOfA
  end;

begin
end.

Global variables fall into the class of items which produce relocatable addresses, and the inline assembler is unable to add or subtract these.

Make sure you don't try to add or subtract relocatable addresses from within your inline assembler statements.