TVarData Differences between x86 and x64 Delphi

I could not find any explanation about TVarData in x64. There is a page in the help, but it looks like TVarData on x64 and TVarData on x86 are different. I'm actually trying to compile DEHL for an x64 target. But he says "Invalid type" on this line: (Source is TVarData)

Big := TBigCardinalVarData(Source).BigCardinalPtr^; 

And TBigCardinalVarData is here:

 TBigCardinalVarData = packed record VType: TVarType; Reserved1, Reserved2, Reserved3: Word; BigCardinalPtr: PBigCardinal; Reserved4: LongWord; end; 

It compiles on x86, but it refuses to compile on x64. I think the problem is with the Word and LongWord variables. But I still could not understand.

+6
source share
1 answer

The problem is the declaration of the packed record , the type of the packed record becomes the type of record in X64, so you must remove the "packed" from the "packed record" in the declaration and use the ALIGN Directive instead.

 {$ALIGN 8} TBigCardinalVarData = record VType: TVarType; Reserved1, Reserved2, Reserved3: Word; BigCardinalPtr: PBigCardinal; Reserved4: LongWord; end; 

read these notes for more details

+12
source

Source: https://habr.com/ru/post/899367/


All Articles