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

From RAD Studio
Jump to: navigation, search

Go Up to Error and Warning Messages (Delphi)


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.