[fpc-devel] VMT compatibility
    Alexey Barkovoy 
    clootie at ixbt.com
       
    Sat Jan 29 22:41:03 CET 2005
    
    
  
Hi,
I where any chance to see FreePascal generating VMT's for classes that is more 
compatible with C++ / TurboPascal / Delphi one?
To explain mine question: recently I've been porting Delphi framework 
interfacing to C++ code to FPC and finded out that althrow Delphi VMT layout is 
compatible to C++ one, FPC is not. Let's see two examples: (1) is C++ and (2) is 
pascal one. In Delphi and C++ DoSomething method is located at ZERO offtet in 
VMT (i.e. PPointer(Self)^ == address of DoSomething). In FreePascal DoSomething 
is located with offset of 80 bytes (i.e. @PPChar(Self)^[80] == address of 
DoSomething).
(1)
typedef class IMyClass
{
    public:
        __cdecl virtual void DoSomething()=0;
} *lpMyClass;
(2)
type
  IMyClass = class(TObject)
  public
    procedure DoSomething; virtual; cdecl; abstract;
  end;
Regards,
Alexey Barkovoy
    
    
More information about the fpc-devel
mailing list