Delphi XE7 Android Record with String Element won’t compile


In Delphi FMX XE7, Win32, I have a record type:

type TSettingsRec = record
SessionTimeOut: Word;
EventString: String[50];

When I change the Target to Android, I get a compiler error:

[DCC Error] MainForm.pas(45): E2029 ‘;’ expected but ‘[‘ found

I need to define the length[50] of the EventString element because the TRecord is actually being read from a database (Firebird) which was written to the database by a Delphi 7 program using Bin2Hex (for a reason known only to the author of that program):

rec: TSettingsRec;
settings: string;

SetLength(settings, SizeOf(rec)*2);
BinToHex(@rec, @settings[1]), SizeOf(rec));

This I decode effectively in using XE7 (win32) using:

rec: TSettingsRec;
settings: String;

SetLength(settings, SizeOf(rec) * 2);
System.Classes.HexToBin(Pchar(settings), @rec, SizeOf(rec));

But this doesn’t work, when I compile for Android. So how do I specify the length [50] of the EventString on the Android platform?

Comments are closed.