#1 2016-12-14 09:32:50

hnb
Member
Registered: 2015-06-15
Posts: 291

Breaking changes in FPC for RTTI

Hi,

we have very important changes for FPC (comes from NewPascal with a few adjustments):

https://github.com/newpascal/freepascal … 9ffaa8a6ad

RTTI layout for records is different and in few cases more Delphi compatible. Maybe not directly compatible... Now is possible to obtain access to *real* managed fields (by RTTI INIT table for records by InitTable field). New layout:

  PRecordInfoFull=^TRecordInfoFull;
  TRecordInfoFull={$ifdef USE_PACKED} packed{$endif USE_PACKED}
  record
    InitTable: Pointer; // PRecordInfoInit
    Size: Longint;
    Count: Longint;
    { Elements: array[count] of TRecordElement }
  end;

  PRecordInfoInit=^TRecordInfoInit;
  TRecordInfoInit= {$ifdef USE_PACKED}packed{$endif USE_PACKED}
  record
    Terminator: Pointer;
    Size: Longint;
    Count: Longint;
    { Elements: array[count] of TRecordElement }
  end;

This RTTI is incompatible (yet) with NewPascal. I need to merge this in proper way. In NewPascal InitTable/Terminator is placed after Size field.

Anyway more breaking changes is coming... So be aware.

Last edited by hnb (2016-12-14 20:40:44)


best regards,
Maciej Izak

Offline

#2 2016-12-14 15:50:24

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,215
Website

Re: Breaking changes in FPC for RTTI

Is there any FPC_HAS_***** conditional available to identify such breaking change?

Online

#3 2016-12-14 18:08:42

hnb
Member
Registered: 2015-06-15
Posts: 291

Re: Breaking changes in FPC for RTTI

Sorry but no. The only proper solution is to use {$ifndef VER3_0} (FPC has official support only for latest stable version and for trunk (2.6.x is not officially supported anymore so {$ifndef VER3_0} make sense). Eventually if we like to support somehow 2.6.x we could use {$if FPC_FULLVERSION>30100} instead of {$ifndef VER3_0}.

FPC is open source so IMO we (as mORMot community) don't need to provide support for versions older than 3.0.x...


best regards,
Maciej Izak

Offline

#4 2016-12-15 09:12:22

hnb
Member
Registered: 2015-06-15
Posts: 291

Re: Breaking changes in FPC for RTTI

I will inform about all breaking changes in this topic. We have again small update in https://github.com/newpascal/freepascal … 437b3288e1

First post updated (InitTable field)!


best regards,
Maciej Izak

Offline

#5 2016-12-16 10:12:56

hnb
Member
Registered: 2015-06-15
Posts: 291

Re: Breaking changes in FPC for RTTI

hnb wrote:

Sorry but no. The only proper solution is to use {$ifndef VER3_0} (FPC has official support only for latest stable version and for trunk (2.6.x is not officially supported anymore so {$ifndef VER3_0} make sense). Eventually if we like to support somehow 2.6.x we could use {$if FPC_FULLVERSION>30100} instead of {$ifndef VER3_0}.

I know that you are not happy about that but IMO is impossible to put for each change new FPC_HAS_* ... sad I do what I can best for improved RTTI. Finally we have small steps in right direction.


best regards,
Maciej Izak

Offline

Board footer

Powered by FluxBB