HomeDelphiDelphi Error – E2107 Operand size mismatch

Delphi Error – E2107 Operand size mismatch

Delphi Compiler Error

E2107 Operand size mismatch

Reason for the Error & Solution

The size required by the instruction operand does not match the size given.

program Produce;

  var
    v : Integer;

  procedure Assembly;
  asm
    db offset v
  end;

begin
end.

In the sample above, the compiler will complain because the ‘offset’ operator produces a ‘dword’, but the operator is expecting a ‘byte’.

program Solve;

  var
    v : Integer;

  procedure Assembly;
  asm
    dd offset v
  end;

begin
end.

The solution, for this example, is to change the operator to receive a ‘dword’. In the general case, you will need to closely examine your code and ensure that the operator and operand sizes match.

Share:

Leave a Reply

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...