[fpc-pascal] How to get the offset of a record

Florian Klämpfl florian at freepascal.org
Sat Apr 30 15:15:21 CEST 2011


> o := PtrUInt( @recvar.var1 ) - PtrUInt( @recvar );
> o := PtrIUnt( @recvar.var2 ) - PtrUInt( @recvar );
> o := PtrInUt( @recvar.var3 ) - PtrUInt( @recvar );

Actually even
o := PtrUInt(@(rectype(nil^).var1)));
is possible.



More information about the fpc-pascal mailing list