Recent

Author Topic: RTTI libraries for FPC  (Read 6421 times)

Int

  • Newbie
  • Posts: 5
RTTI libraries for FPC
« on: April 09, 2016, 12:59:59 pm »
Hello!

I'm looking for implementation of RTTI features in FPC.
I've figured out how to work with published properties via TypInfo unit.
But I still cannot find a way to dynamically invoke methods with unknown signature at compile time.

As far as I understand there is ObjAuto.ObjectInvoke http://docwiki.embarcadero.com/Libraries/Seattle/en/System.ObjAuto.ObjectInvoke since Delphi 7 (or even earlier) but there's no ObjAuto in FPC (right?).

Maybe there is a library that can do most of Delphi's RTTI or at least ObjAuto.
I was thinking about writing my own implementation but I don't think one's quality would be good enough. Furthermore I've seen a few topics related to RTTI support in FPC, such as
http://forum.lazarus.freepascal.org/index.php/topic,27538.0.html, where @darupe said that he worked on his library but I didn't found much information about it.

There are a few links that I found during the searching:
http://hallvards.blogspot.com/2006/09/extended-class-rtti.html - "Extended class RTTI"
http://stackoverflow.com/questions/36426460/delphi-which-methods-are-supposed-to-be-in-rtti related question on Stackoverflow
in russian: http://keyfighter.blogspot.ru/2014/09/free-pascal.html - "Tricks with objects"
http://forum.lazarus.freepascal.org/index.php?topic=30678.0%29
http://stackoverflow.com/questions/36188402/freepascal-rtti-is-there-a-way-to-invoke-method

I'd be glad for any other articles!

P.s.
How soon is RTTI support going to be implement in FPC? I'm interested in both RTTI (like Delphi 2010+) and more low libraries like ObjAuto etc.


hnb

  • Sr. Member
  • ****
  • Posts: 270
Re: RTTI libraries for FPC
« Reply #1 on: April 09, 2016, 02:56:29 pm »
There is branch for attributes ( http://svn.freepascal.org/cgi-bin/viewvc.cgi/branches/joost/?sortby=date ) but a little outdated  ( last commit - Sun Oct 20 20:49:45 2013 ) and incomplete (lack of finished RTTI module).

Extended RTTI (+RTTI and ObjAuto module) is on my TODO list, but I don't have any timeline for this.
Checkout NewPascal initiative and donate beer - ready to use tuned FPC compiler + Lazarus for mORMot project

best regards,
Maciej Izak

Int

  • Newbie
  • Posts: 5
Re: RTTI libraries for FPC
« Reply #2 on: April 09, 2016, 05:01:36 pm »
I'm sorry I'm confused a bit. What exactly does this branch? Does it have kind of readme or list of features?

hnb

  • Sr. Member
  • ****
  • Posts: 270
Re: RTTI libraries for FPC
« Reply #3 on: April 09, 2016, 09:09:20 pm »
Initial implementation of extended RTTI (like in Delphi > 2009). To get more info you need to track revision logs for the branch...
Checkout NewPascal initiative and donate beer - ready to use tuned FPC compiler + Lazarus for mORMot project

best regards,
Maciej Izak

Isaque Pinheiro

  • Newbie
  • Posts: 3
    • ORMBr Framework for Delphi
Re: RTTI libraries for FPC
« Reply #4 on: August 31, 2018, 07:01:10 pm »
There is branch for attributes ( http://svn.freepascal.org/cgi-bin/viewvc.cgi/branches/joost/?sortby=date ) but a little outdated  ( last commit - Sun Oct 20 20:49:45 2013 ) and incomplete (lack of finished RTTI module).

Extended RTTI (+RTTI and ObjAuto module) is on my TODO list, but I don't have any timeline for this.
I am the author of Project ORMBr for Delphi (OpenSource)
www.ormbr.com.br

I need this resource to port to Lazarus.
« Last Edit: August 31, 2018, 10:15:17 pm by isaquepinheiro »

Isaque Pinheiro

  • Newbie
  • Posts: 3
    • ORMBr Framework for Delphi
Re: RTTI libraries for FPC
« Reply #5 on: August 31, 2018, 08:12:04 pm »
Initial implementation of extended RTTI (like in Delphi > 2009). To get more info you need to track revision logs for the branch...

Would not there be, the possibility of this feature being in a package?

PascalDragon

  • Hero Member
  • *****
  • Posts: 5481
  • Compiler Developer
Re: RTTI libraries for FPC
« Reply #6 on: August 31, 2018, 09:45:18 pm »
No, because for any RTTI unit to work the compiler must generate the necessary information. Currently (for trunk as well as the upcoming 3.2.0) this is only the case for interface methods.

Isaque Pinheiro

  • Newbie
  • Posts: 3
    • ORMBr Framework for Delphi
Re: RTTI libraries for FPC
« Reply #7 on: August 31, 2018, 10:09:50 pm »
lamentable...

 

TinyPortal © 2005-2018