3

For the time being, Delphi XE is only available on my box, I don't know wether Delphi 2010/XE2 has introduced some breaking changes.

Please help me to update the following definition:

TVmt = packed record
    SelfPtr           : TClass;
    IntfTable         : Pointer;
    AutoTable         : Pointer;
    InitTable         : PFieldTable;
    TypeInfo          : PTypeInfo;
    FieldTable        : Pointer;
    MethodTable       : Pointer;
    DynamicTable      : Pointer;
    ClassName         : PShortString;
    InstanceSize      : Cardinal;
    Parent            : PClass;
    {$IFDEF DELPHI2009_UP}
    Equals            : Pointer;
    GetHashCode       : Pointer;
    ToString          : Pointer;
    {$ENDIF}
    {$IFDEF DELPHIXE_UP}
    // ???
    {$ENDIF}
    {$IFDEF DELPHIXE2_UP}
    // ???
    {$ENDIF}
    SafeCallException : PSafeCallException;
    AfterConstruction : PAfterConstruction;
    BeforeDestruction : PBeforeDestruction;
    Dispatch          : PDispatch;
    DefaultHandler    : PDefaultHandler;
    NewInstance       : PNewInstance;
    FreeInstance      : PFreeInstance;
    Destroy           : PDestroy;
    {UserDefinedVirtuals: array of procedure;}
  end;

Thanks in advance.


The information I need can be grabed from the unit system.pas. While I check it as Delphi XE version, I discover also that the VMT depend on the CPU (Blame it on me, it obvious / search for the {$IF defined(CPUX64)} directive for further details).

I'm interested in 32 bits Windows platform.

menjaraz
  • 7,551
  • 4
  • 41
  • 81
  • 1
    See [Internal_Data_Formats](http://docwiki.embarcadero.com/RADStudio/en/Internal_Data_Formats). Doesn't look as there are any changes. – LU RD Apr 15 '12 at 06:43
  • @LU RD: Pointer slots of *Equals/GetHashCode/ToString* are not present. They should be located between the *pointer to a pointer to ancestor class* <=> `Parent` (offset -36) and *pointer to entry point of SafecallException method* <=> `SafeCallException` (offset -34). It seems that it rather describes a Delphi 2007 VMT. – menjaraz Apr 15 '12 at 07:03
  • Yes, I see that now. Documentation is not always up to date, but programmers have to be :) – LU RD Apr 15 '12 at 07:10
  • @LU RD: You are right, that's also why I ask for help. Thank you for removing my doubt. – menjaraz Apr 15 '12 at 07:24
  • See also this SO question [where-can-i-find-information-on-the-structure-of-the-delphi-vmt](http://stackoverflow.com/q/760513/576719). – LU RD Apr 15 '12 at 07:25
  • @LU RD: Hallvard is kicking and alive but purposedly stay out of the arena for the time being. Rob Kennedy's VMT page need to also to be brushed up as of the time of posting. – menjaraz Apr 15 '12 at 07:50
  • If I had a later version of Delphi, or if I'd even *used* Delphi since 2007, I might consider updating my site. On the other hand, my site doesn't talk about the number of virtual methods; it's only implicit in the value of `vmtParent`, nobody should be relying on the *value* of it anyway. – Rob Kennedy Apr 16 '12 at 14:15
  • @Rob Kennedy: You are right, I have missed that. Thank you. – menjaraz Apr 16 '12 at 16:29

1 Answers1

3

A quick review of XE2's System.pas doesn't show any differences in the ordering and content of the VMT. There's an {$IFDEF CPUX64} for different offsets for the vmt* values, but the order and types seem to be the same. There's definitely nothing new in the areas you have marked with ???

Ken White
  • 123,280
  • 14
  • 225
  • 444