HomeDelphiDelphi Error – E2091 Segment/Offset pairs not supported in 32-bit Delphi

Delphi Error – E2091 Segment/Offset pairs not supported in 32-bit Delphi

Delphi Compiler Error

E2091 Segment/Offset pairs not supported in 32-bit Delphi

Reason for the Error & Solution

32-bit code no longer uses the segment/offset addressing scheme that 16-bit code used.

In 16-bit versions of Object Pascal, segment/offset pairs were used to declare absolute variables, and as arguments to the Ptr standard function.

Note that absolute addresses should not be used in 32-bit protected mode programs. Instead appropriate Win32 API functions should be called.

program Produce;

var
  VideoMode : Integer absolute $0040 $0049;

begin
  Writeln( Byte(Ptr($0040,$0049)^) );
end.

The following version compiles, but it does not run. You must avoid absolute addresses carefully.

program Solve;

var
  VideoMode : Integer absolute $0040*16+$0049;

begin
  Writeln( Byte(Ptr($0040*16+$0049)^) );
end.

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