* * *

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

SymbolicFrank

  • Sr. Member
  • ****
  • Posts: 299
TArray<T> in {$mode Delphi}
« on: September 12, 2017, 12:16:06 pm »
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).

The last time I encountered this I changed all the code to use "array of T" instead. That does work, but it requires changing a lot of constructs.

This is on Lazarus 1.6.4 on Windows, but it also happened with older versions (1.2 and 1.4).

Is there an easier way to get this to work?

Xor-el

  • Jr. Member
  • **
  • Posts: 84
Re: TArray<T> in {$mode Delphi}
« Reply #1 on: September 12, 2017, 12:44:38 pm »
If I remember correctly, install the latest trunk version through fpcdeluxe, it supports it.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3086
  • I like bugs.
Re: TArray<T> in {$mode Delphi}
« Reply #2 on: September 12, 2017, 01:11:34 pm »
If I remember correctly, install the latest trunk version through fpcdeluxe, it supports it.
Trunk version of FPC.
SymbolicFrank wrote about Lazarus versions but generics containers are part of FPC sources.

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5648
Re: TArray<T> in {$mode Delphi}
« Reply #3 on: September 12, 2017, 01:18:08 pm »
FPC 3.0.x requires it too, but then you'll need an additional old version of the generics.* units and not everything works fine.

If you have heavy dependence on Delphi style generics and generics.* units, trunks is your best chance. (quite a lot works, often more than in older Delphi XE versions)

SymbolicFrank

  • Sr. Member
  • ****
  • Posts: 299
Re: TArray<T> in {$mode Delphi}
« Reply #4 on: September 12, 2017, 02:28:52 pm »
The current units are the Biginteger package from Rudy Velthuis. I decided to finally finish my secure communication functionality, which requires (among other things) RSA.

How stable is trunk? Should I implement cryptography with it?

Xor-el

  • Jr. Member
  • **
  • Posts: 84
Re: TArray<T> in {$mode Delphi}
« Reply #5 on: September 12, 2017, 03:01:07 pm »
Trunk is pretty stable from my experience and you get some bleeding edge features with it.
Regarding Rudy's big integer implementation, it would be nice if you can share your final FPC compatible code when you are done. Probably we might convince Rudy to include it in his branch.
Tried making it FPC compatible before but got caught up with some real life stuffs.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3086
  • I like bugs.
Re: TArray<T> in {$mode Delphi}
« Reply #6 on: September 12, 2017, 03:22:49 pm »
@Xor-el, I found this:
  https://github.com/Xor-el/IntXLib4Pascal
You apparently have already ported a Big Integer Library for Pascal.
Maybe it is different from Rudy Velthuis' library and cannot be used as a replacement, I don't know.

Xor-el

  • Jr. Member
  • **
  • Posts: 84
Re: TArray<T> in {$mode Delphi}
« Reply #7 on: September 12, 2017, 03:26:40 pm »
@Xor-el, I found this:
  https://github.com/Xor-el/IntXLib4Pascal
You apparently have already ported a Big Integer Library for Pascal.
Maybe it is different from Rudy Velthuis' library and cannot be used as a replacement, I don't know.

Yes, but I am a kind of person who loves varieties, a lot of options to choose from :)

SymbolicFrank

  • Sr. Member
  • ****
  • Posts: 299
Re: TArray<T> in {$mode Delphi}
« Reply #8 on: September 12, 2017, 04:10:46 pm »
Wow, you even already implemented IsProbablyPrime. That always takes me the most time when I create an RSA library. I'm going to take a good look at that first.

Decisions, decisions.

SymbolicFrank

  • Sr. Member
  • ****
  • Posts: 299
Re: TArray<T> in {$mode Delphi}
« Reply #9 on: September 12, 2017, 05:01:18 pm »
Btw, if I make something that seems useful as a stand-alone library, then of course I will make it available.

But I tend to make mostly demos, tools and small servers (ie. anything that doesn't require meetings and extensive specs) with Lazarus. About two or three a month. Stuff I have to book under "Other activities". Because if the management has a say in it, it always has to be in something like C++, C# or Java.

Remy Lebeau

  • Sr. Member
  • ****
  • Posts: 324
    • Lebeau Software
Re: TArray<T> in {$mode Delphi}
« Reply #10 on: September 13, 2017, 01:10:59 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}).
Remy Lebeau
Lebeau Software - Owner, Developer
Internet Direct (Indy) open source project - Admin, Developer

Akira1364

  • Sr. Member
  • ****
  • Posts: 300
Re: TArray<T> in {$mode Delphi}
« Reply #11 on: September 14, 2017, 01:42:20 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}).

lol this is very wrong. How could you possibly have actually used FPC recently and believe this?

Remy Lebeau

  • Sr. Member
  • ****
  • Posts: 324
    • Lebeau Software
Re: TArray<T> in {$mode Delphi}
« Reply #12 on: September 14, 2017, 02:39:00 am »
lol this is very wrong. How could you possibly have actually used FPC recently and believe this?

I don't use FPC at all.  I'm only here to provide support for Indy users, and pitch in where I can.
Remy Lebeau
Lebeau Software - Owner, Developer
Internet Direct (Indy) open source project - Admin, Developer

Akira1364

  • Sr. Member
  • ****
  • Posts: 300
Re: TArray<T> in {$mode Delphi}
« Reply #13 on: September 14, 2017, 02:57:48 am »
lol this is very wrong. How could you possibly have actually used FPC recently and believe this?

I don't use FPC at all.  I'm only here to provide support for Indy users, and pitch in where I can.

Uh, well, that explains it then I guess?

SymbolicFrank

  • Sr. Member
  • ****
  • Posts: 299
Re: TArray<T> in {$mode Delphi}
« Reply #14 on: September 14, 2017, 08:41:13 am »
Ok, I checked out and build Lazarus trunk. I changed the description on the wiki to use a separate debug info file, because an executable of 186 MB is far too big.

And now I still get a silent error, but it seems to be the first time it encounters a "class property". There is a wiki page about "extended class syntax" that shows them, but it doesn't say how to enable them.

So, anyone knows how to do that?

 

Recent

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