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.