Jump to content
dummzeuch

Values for vmtArcOffset and CPP_ABI_ADJUST

Recommended Posts

I need the values for the constants vmtArcOffset and CPP_ABI_ADJUST (declared in the System unit) for various platforms. I know them for

  • Win32  (both 0)
  • Win64 (0 and 24 = 3*SizeOf(Pointer64))
  • Android32 (0 and 12 = 3*SizeOf(Pointer32))
  • Android64 (0 and 24 = 3*SizeOf(Pointer64))
  • IOS64 (0 and 24 = 3*SizeOf(Pointer64))
  • OSX64 (0 and 24 = 3*SizeOf(Pointer64))

Could somebody who develops for other platforms please look them up and tell me?

  • IOS32
  • OSX32
  • Linux

 

I'm not sure about the vmtArcOffset and how it changed for different platforms when Embarcadero introduced and when they later dropped ARC support. the automatic reference counting ARC support supposedly sets vmtArcOffset = 2 * SizeOf(Pointer).

Share this post


Link to post

Well, in System.pas from 10.4.1 they are declared like this:

 

{$IFDEF AUTOREFCOUNT}
  vmtArcOffset    = 2 * SizeOf(Pointer);
{$ELSE}
  vmtArcOffset    = 0;
{$ENDIF}

{$IFDEF CPP_ABI_SUPPORT}
  CPP_ABI_ADJUST = 3 * SizeOf(Pointer);
{$ELSE !CPP_ABI_SUPPORT}
  CPP_ABI_ADJUST = 0;
{$ENDIF !CPP_ABI_SUPPORT}

 

Share this post


Link to post
17 minutes ago, Uwe Raabe said:

Well, in System.pas from 10.4.1 they are declared like this:

 


{$IFDEF AUTOREFCOUNT}
  vmtArcOffset    = 2 * SizeOf(Pointer);
{$ELSE}
  vmtArcOffset    = 0;
{$ENDIF}

{$IFDEF CPP_ABI_SUPPORT}
  CPP_ABI_ADJUST = 3 * SizeOf(Pointer);
{$ELSE !CPP_ABI_SUPPORT}
  CPP_ABI_ADJUST = 0;
{$ENDIF !CPP_ABI_SUPPORT}

 

Yes, I know, that's where I got those constant names from, but I don't know for which platform which symbol is defined.

Share this post


Link to post

I found an easier solution: I'm now using IOTAThread.Evaluate to get the values of these constants (actually I needed vmtParent and vmtClassName which I originally wanted to calculate like the RTL does). Seems to work and doesn't even require me to know the target platform.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×