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

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

You May Also Like

Delphi Compiler Error E2313 Attribute – Known attribute cannot specify properties Reason for the Error & Solution No further information...
Delphi Compiler Error E2379 Virtual methods not allowed in record types Reason for the Error & Solution No further information...
Rodrigo , one of the long time Delphi Developer has been working on one of his personal project “Delphi IDE...