How to start

Top  Previous  Next

You will obtain good C++ translations of your Delphi code only if the correct settings are selected in the Translation Options dialog, which can be opened using the button  OptionsProject .

 

1. Paths to Your Source Code

 

Delphi2C# must know the types and signatures of procedures and functions used in your Delphi source code in order to generate correct translations.

 

This is straightforward for your own source code. You simply need to configure the paths to your source files in the options dialog.

 

 

2. Paths to the Delphi RTL/VCL

 

 

The paths to the Delphi RTL/VCL source files used by your application must also be configured in the Delphi2C# project settings.

 

If you are using Delphi2C# for the first time and simply want to obtain initial translation results quickly, you may use the original Delphi RTL/VCL source directories as the search path for the files not to convert.

 

Unfortunately, the original Delphi source code itself contains a number of inconsistencies and special cases. Therefore, for long-term use it is recommended that you prepare a copy of Embarcadero's sources for use with Delphi2C#.

 

 

3. Extended System.pas

 

You should use also an "extended System.pas". This file corrects and completes the original "System.pas".

 

 

4. Setting the Correct Conditional Definitions

 

 

Even if you have selected the correct search paths for the Delphi RTL/VCL, your code may still not be translated correctly unless the required conditional definitions are set properly.

 

By default, MSWINDOWS is defined. If this were not the case, even the original SysUtils.pas could not be parsed correctly, because code such as the following would become invalid:

 

function AdjustLineBreaks(const S: string; Style: TTextLineBreakStyle =

        {$IFDEF LINUX} tlbsLF {$ENDIF}

        {$IFDEF MSWINDOWS} tlbsCRLF {$ENDIF}): string;

 

 

 

5. Creating a Dummy Application or Performing a Complete Translation

 

Normally, Delphi2Cpp performs a complete translation of the selected project.

 

However, if your source code is incomplete or not yet fully compilable, you may choose to create a dummy application first.

 

 

6. Starting the Translation

 

 

After configuring the translation options, you can save them using the button ProjectSaveAs .

Next, open the first file to translate using the button FileOpen.

Start the translation by clicking the button Arrow_r.

 

As soon as the translation has finished, the C# source code is displayed in the windows on the right side of the application.

 

The content shown on the left side may also change. In this case, the preprocessed Delphi code is displayed there.

 

You can save the translated code using the button FileSaveAs.

 

 

 



This page belongs to the Delphi2C# Documentation

Delphi2C# home  Content