Delphi Error – E2119 Structure field identifier expected

Delphi Compiler Error

E2119 Structure field identifier expected

Reason for the Error & Solution

The inline assembler recognized an identifier on the right side of a ‘.’, but it was not a field of the record found on the left side of the ‘.’. One common, yet difficult to realize, error of this sort is to use a record with a field called ‘ch’ – the inline assembler will always interpret ‘ch’ to be a register name.

program Produce;

  type
    Data = record
      x : Integer;
    end;

  procedure AssemblerExample(d : Data; y : Char);
  asm
    mov  eax, d.y
  end;

begin
end.

In this example, the inline assembler has recognized that ‘y’ is a valid identifier, but it has not found ‘y’ to be a member of the type of ‘d’.

program Solve;

  type
    Data = record
      x : Integer;
    end;

  procedure AssemblerExample(d : Data; y : Char);
  asm
    mov  eax, d.x
  end;

begin
end.

By specifying the proper variable name, the error will go away.

Share:

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

Delphi Compiler Error X2421 Imported identifier ‘%s’ conflicts with ‘%s’ in ‘%s’ Reason for the Error & Solution This occurs...
Delphi Compiler Error X2367 Case of property accessor method %s.%s should be %s.%s Reason for the Error & Solution No...
Delphi Compiler Error X2269 Overriding virtual method ‘%s.%s’ has lower visibility (%s) than base class ‘%s’ (%s) Reason for the...