Delphi RTTI vs Free Pascal RTTI

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Delphi RTTI vs Free Pascal RTTI

African Wild Dog
Hello,

I need to write a code compatilble with both free pascal and delphi using the old style RTTI.
What are the diferences between delphi's and free pascal's approach/types?

I took a look at delphi's and fpc's TypInfo unit and it looks like the types/functions are compatible.

Regards

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Delphi RTTI vs Free Pascal RTTI

Michael Van Canneyt


On Fri, 24 Mar 2017, African Wild Dog wrote:

> Hello,
>
> I need to write a code compatilble with both free pascal and delphi using
> the old style RTTI.
> What are the diferences between delphi's and free pascal's approach/types?
>
> I took a look at delphi's and fpc's TypInfo unit and it looks like the
> types/functions are compatible.

They are. There is one dereference on Delphi which is not present in fpc,
although in fpc trunk, this additional dereference is there. If you use the
standard functions you should not notice this.

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Delphi RTTI vs Free Pascal RTTI

Graeme Geldenhuys-6
On 2017-03-24 18:55, Michael Van Canneyt wrote:
> They are. There is one dereference on Delphi which is not present in fpc,
> although in fpc trunk

Another minor difference is data types. From what I remember (and as can
be seen in tiOPF's code. eg: tiRTTI.pas) FPC has a few more data types
than Delphi. eg: FPC had tkBool, whereas Delphi didn't. There were also
some differences with string types like tkAString, tkUChar and such. Not
a big difference though.

Regards,
  Graeme

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Delphi RTTI vs Free Pascal RTTI

Karoly Balogh (Charlie/SGR)
Hi,

On Fri, 24 Mar 2017, Graeme Geldenhuys wrote:

> On 2017-03-24 18:55, Michael Van Canneyt wrote:
> > They are. There is one dereference on Delphi which is not present in fpc,
> > although in fpc trunk
>
> Another minor difference is data types. From what I remember (and as can
> be seen in tiOPF's code. eg: tiRTTI.pas) FPC has a few more data types
> than Delphi. eg: FPC had tkBool, whereas Delphi didn't. There were also
> some differences with string types like tkAString, tkUChar and such. Not
> a big difference though.

FPC also has tkQWord, among others. Just for the record, here's the FPC
version:

http://www.freepascal.org/docs-html/rtl/typinfo/ttypekinds.html

plus a few aliases:

http://www.freepascal.org/docs-html/rtl/typinfo/index-2.html

vs. Delphi version:

http://docwiki.embarcadero.com/Libraries/Seattle/en/System.TTypeKind

Charlie
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Delphi RTTI vs Free Pascal RTTI

Free Pascal - General mailing list
In reply to this post by Michael Van Canneyt

Am 24.03.2017 19:55 schrieb "Michael Van Canneyt" <[hidden email]>:
>
>
>
> On Fri, 24 Mar 2017, African Wild Dog wrote:
>
>> Hello,
>>
>> I need to write a code compatilble with both free pascal and delphi using
>> the old style RTTI.
>> What are the diferences between delphi's and free pascal's approach/types?
>>
>> I took a look at delphi's and fpc's TypInfo unit and it looks like the
>> types/functions are compatible.
>
>
> They are. There is one dereference on Delphi which is not present in fpc,
> although in fpc trunk, this additional dereference is there. If you use the
> standard functions you should not notice this.

The binary data of RTTI added before 3.1.1 now has the double indirection, but the Delphi-compatible "field" names have only a single indirection for backwards compatibility (they are properties to the double indirection fields). RTTI data added in 3.1.1 only has the double indirection.
So this difference needs to be kept in mind and will always result in ifdefs for RTTI code that handles both Delphi and FPC.

Regards,
Sven


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Delphi RTTI vs Free Pascal RTTI

African Wild Dog


2017-03-25 5:40 GMT-03:00 Sven Barth via fpc-pascal <[hidden email]>:

Am 24.03.2017 19:55 schrieb "Michael Van Canneyt" <[hidden email]>:
>
>
>
> On Fri, 24 Mar 2017, African Wild Dog wrote:
>
>> Hello,
>>
>> I need to write a code compatilble with both free pascal and delphi using
>> the old style RTTI.
>> What are the diferences between delphi's and free pascal's approach/types?
>>
>> I took a look at delphi's and fpc's TypInfo unit and it looks like the
>> types/functions are compatible.
>
>
> They are. There is one dereference on Delphi which is not present in fpc,
> although in fpc trunk, this additional dereference is there. If you use the
> standard functions you should not notice this.

The binary data of RTTI added before 3.1.1 now has the double indirection, but the Delphi-compatible "field" names have only a single indirection for backwards compatibility (they are properties to the double indirection fields). RTTI data added in 3.1.1 only has the double indirection.
So this difference needs to be kept in mind and will always result in ifdefs for RTTI code that handles both Delphi and FPC.

Regards,
Sven



Thanks for the clarifications.

Regards

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal