Delphi

Installing Delphi 7 on Windows 7/8/10/Server 2012

How to install and use Delphi 7 and help files on Windows 8/10 or Server 2012.

Installation

Start Delphi setup and install all required items including help files.

In Windows 8/Server 2012 or later (should work on Windows 7 too):

  • Create the shortcut to Delphi32.exe
  • Open shortcut properties and set "run as administrator" option
  • Add Delphi to the of DEP (Data Execution Prevention). Go to My Computer - Properties - Advanced System Settings - Performance Settings - Data Execution Prevention

Bit-packed structure (record) in Free Pascal and Delphi

Here is the code explaining some methods to pack bit accessing logic in your program.

program project1;
 
type
  TRec1 = packed record // Doesn't pack at all
    b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16: boolean;
  end;
 
  TRec2 = bitpacked record // Free Pascal specific
    b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16: boolean;
  end;
 
  TRecByte = (b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16);
  TRecBytes = set of TRecByte;
var
  r1: TRec1;
  r2: TRec2;
  s1: TRecBytes;

Why need to specify unit names?

In the previous article "Crack C# namespaces in 30 seconds" I demonstrated how to make error having no idea about it. So you will have a lovely time in debugging. But in C# you're condemned to use using directive or your code will be unreadable with all these horrible specifiers MySolution.AppModules.Accounting.AccountingType.DefaultValue.

Delphi and Free Pascal bencmark: array vs TList vs dynamic array

Let's perform a simple benchmark testing the random and sequential access to arrays and lists. I would like to compare:

  • static array with predefined size (allocated on stack)
  • TList container class (allocated on heap)
  • dynamic array (allocated on heap)
  • generic Delphi TList or Free Pascal TFPGList (allocated on heap)

I use an array/list of 10M elements of integer and varaint data type. You can change the type definition in "type" section if need to test other cases.

Crack C# namespaces in 30 seconds

The namespaces conception in C# seems exhaustive and insufficient at the same time in comparison with strong module notation like in Oberon-2 and even with modular programming like in Free Pascal/Delphi.

Why insufficient? You cannot declare constants and functions within namespaces but you should add a class with constant field or static method for it. It's really sad...

Why exhaustive? The "using" directive with such introduced classes is the source of unexpected errors. Here is an example below.

Make error "Fatal: Command arguments too long"

This bug is reproduced on Delphi 7 and C++Builder 6 at least (probably in later versions too) when starting Borland make utility. Indeed, the message "Fatal: Command arguments too long" and the real problem are as like as chalk and cheese.

Check the length of your PATH variable. In my case the length was > 400 characters. Deleting some paths reduced the length down to 300-350 characters and solve the problem.

Pages

Subscribe to RSS - Delphi