7.3 Porting Delphi code

Porting Delphi code should be quite painless. The Delphi mode of the compiler tries to mimic Delphi as closely as possible. This mode can be enabled using the -Mdelphi command line switch, or by inserting the following code in the sources before the unit or program clause:

{$IFDEF FPC}  
{$MODE DELPHI}  
{$ENDIF FPC}

This ensures that the code will still compile with both Delphi and FPC.

Nevertheless, there are some things that will not work. Delphi compatibility is relatively complete up to Delphi 7. New constructs in higher versions of Delphi (notably, the versions that work with .NET) are not supported.

  7.3.1 Missing language constructs
  7.3.2 Missing calls / API incompatibilities
  7.3.3 Delphi compatibility mode
  7.3.4 Best practices for porting