Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2015-09

RTTI

5 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Alfred

Answer of Steve included in this mail, while missing in list !

1:
I need to know before compiling the source if interface RTTI is available.
I would like to use a switch in the source:
{$ifdef HASNEWINTERFACERTTI}
....
{$endif}

2:
Well ... this is the FPC/Delphi structure at the moment:
TIntfMethodEntryTail =
     {$ifndef FPC_REQUIRES_PROPER_ALIGNMENT}
     packed
     {$endif}
     record
       {$ifdef FPC}
       Version: Byte; // always 3 at the moment
       {$else} // Delphi
       Kind: TMethodKind;
       {$endif}
       CC: TCallingConvention;
       {$ifdef FPC}
       ResultType: PTypeInfo;
       StackSize: Word;
       {$endif}
       ParamCount: Byte;
       {Params: array[0..ParamCount - 1] of TVmtMethodParam;}
   end;

Alfred.

Show quoted text 20 lines
What exactly does the flag indicate. 1. Reading the structure as in typinfo woks 2. Register / Offset have meaningfull values instead of default 0 / 0 (for unimplemented targets) >2: Alignment >Using brute force (due to lacking compiler knowledge), I could dig >into ARM alignment issues. No problem. >However, at the moment, the issues are known (and correctly >implemented in mORMot). >So, I have to know the goal. >This cast works again: PVmtMethodParam(p)^ This was the important part. >This cast does not work: PIntfMethodEntry(p)^ In my opinion, as long as there is no delphi compatibility broken, the target is whatever we feel comfortable with. >Question: What alignment issues should have to be solved ? If there is no issue with how its currently handled. I would say leave it as is. greets Steve

Reply by email

Steve Hildebrandt
to Alfred
Alfred wrote 7 lines
1: I need to know before compiling the source if interface RTTI is available. I would like to use a switch in the source: {$ifdef HASNEWINTERFACERTTI} .... {$endif}

Will see what I can do in that direction.

Show quoted text 20 lines
2: Well ... this is the FPC/Delphi structure at the moment: TIntfMethodEntryTail = {$ifndef FPC_REQUIRES_PROPER_ALIGNMENT} packed {$endif} record {$ifdef FPC} Version: Byte; // always 3 at the moment {$else} // Delphi Kind: TMethodKind; {$endif} CC: TCallingConvention; {$ifdef FPC} ResultType: PTypeInfo; StackSize: Word; {$endif} ParamCount: Byte; {Params: array[0..ParamCount - 1] of TVmtMethodParam;} end;

This confuses me a bit. I implemented this against the following requirements:
Interface method information (TIntfMethodEntry):
1. Method name as a shortstring (Name)
2. Byte with version of RTTI, equals 3 in Delphi XE4 (version)
3. Calling convention as enumerated: TCallConv (CC)
4. Pointer to result Type (ResultType)
5. Word with total size of data needed for stack parameters + 2*SizeOf(Pointer)
(Return address + Base address for stack parameters)
6. Byte with count of parameters (ParamCount)
7. An array of VMT method parameter descriptions (Params, type TVmtMethodParam)

Is TIntfMethodEntryTail conform with new delphi versions?

greets Steve

Reply by email

Michael Van Canneyt
to Steve Hildebrandt
Steve Hildebrandt wrote 10 lines
Am 10.09.2015 um 12:10 schrieb Alfred: > 1: > I need to know before compiling the source if interface RTTI is available. > I would like to use a switch in the source: > {$ifdef HASNEWINTERFACERTTI} > .... > {$endif} Will see what I can do in that direction.

Usually, this is done with FPC_HAS_XXXYYY. If you look in the RTL, you will see lots of such ifdefs.

So FPC_HAS_EXTENDEDINTERFACERTTI seems appropriate.

Michael.

Reply by email

Steve Hildebrandt
to Michael Van Canneyt
Michael Van Canneyt wrote 22 lines
On Thu, 10 Sep 2015, Steve Hildebrandt wrote: > > > Am 10.09.2015 um 12:10 schrieb Alfred: >> 1: >> I need to know before compiling the source if interface RTTI is >> available. >> I would like to use a switch in the source: >> {$ifdef HASNEWINTERFACERTTI} >> .... >> {$endif} > Will see what I can do in that direction. Usually, this is done with FPC_HAS_XXXYYY. If you look in the RTL, you will see lots of such ifdefs. So FPC_HAS_EXTENDEDINTERFACERTTI seems appropriate. Michael.

Added as sugested to compiler/options.pas in InterfaceRTTI branch.

Steve.

Reply by email