* * *

Author Topic: TArray<T> in {$mode Delphi}  (Read 804 times)


  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5646
Re: TArray<T> in {$mode Delphi}
« Reply #15 on: September 14, 2017, 10:02:23 am »
I have a bunch of Delphi units that use TArray<T>. That generates a silent error (the compiler only says: "Fatal: Compilation aborted" when it encounters them).

Last time I checked, in {$mode Delphi}, FPC is roughly on par with the RTL of Delphi 7, which pre-dates Generics.  I wouldn't expect any newer Delphi RTL features to work correctly in FPC (except for the Unicode additions in {$mode DelphiUnicode}).

Most of the problems are delphi bugs  (like allowing static class procedure to be passed to procedure-variables (Tbinaryoperator) while signature doesn't match) the usual ifdef mess of repeated delphi version queries and not using a scope prefix for multi compiler compatibiliy (be it older Delphi or FPC). FPC, like D7 supports dotted names, but hasn't renamed its RTL like Delphi did. (yet?, jury is still out on that one, but better use scope prefixes in general code for now)

Before I got mired in that exploited Delphi bug, I only found one issue in actual code:

FPC doesn't recognize the somewhat baroque assembler construct:


(added later: and then I mean the type dword part to get I assume the size of dword, replaced it by "4" and it worked fine)
« Last Edit: September 14, 2017, 10:30:58 am by marcov »


  • Sr. Member
  • ****
  • Posts: 299
Re: TArray<T> in {$mode Delphi}
« Reply #16 on: September 14, 2017, 10:28:27 am »
Btw, I did rewrite these same units more than a year ago, but I had to change a lot. Lost the HDD, but I could do it again. But in that case, I rather use the Xor-el library, as those changes require a lot of testing. Mostly because all calculations are dynamic, and I had to rewrite most of that mechanism.



Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus