System Namespace |
Top Previous Next |
What is translated > File layout > System Namespace
At the translation of Delphi code with Delphi2C# the C# System namespace is extended by the entities of the Delphi System. Therefore the Delphi2C# installation provides the file System.cs. System.cs corresponds to System.pas and has roughly the following structure:
namespace System {
// System classes ...
public class TObject { ...
public class TDateTime { ...
public class SystemInterface {
// System constants
public const int MaxInt = Int32.MaxValue; ...
// System functions
public static string Concat(params string[] strings) { ...
public static void SetLength(ref string xs, int xi) { ...
static void System_initialization() { ...
static void System_finalization() { ...
} // SystemInterface
} // namespace System
System.cs starts with the definitions of some fundamental Delphi classes like TObject, TDateTime etc. and some helper classes like PChar, Pointer and so on. The second part of System.cs consists of the definition of a class called SystemInterface which contains public constants and static functions like e.g. MaxInt, Concat and SetLength, which correspond to the constants and functions of the Delphi System with the same name.
All C# files which are generated from Delphi with Delphi2C# are using System.cs by means of the lines:
using System; using static System.SystemInterface;
System.cs cannot be generated automatically from System.pas, because System.pas uses special Delphi internal conventions. For example the SetLength function is declared there as:
procedure _SetLength(s: _PShortStr; newLength: Byte);
Moreover, System.pas is incomplete on the one hand and on the other hand it contains stuff, which isn't needed in C#. There is an extended System.pas, which has to be set in the translation options, to let Delphi2C# know the signatures of the system routines.
|
This page belongs to the Delphi2C# Documentation |
Delphi2C# home Content |