fork download
  1. //OffsetOf - PtrUInt(@(CStruct(nil + 1)^.Y)) - 1;
  2.  
  3. uses SysUtils;
  4.  
  5. type glTexture = record
  6. ID: Int32;
  7. ColourID: Int32;
  8. FullColourID: Int32;
  9. X, Y: Int32;
  10. end;
  11.  
  12. type ptr_glTexture = ^glTexture;
  13.  
  14.  
  15. var
  16. offset: PtrUInt;
  17. p: Pointer;
  18. begin
  19. p := nil;
  20. offset := PtrUInt(@(ptr_glTexture(p)^.X));
  21.  
  22. writeln('offset of X: ' + intToStr(offset));
  23. end.
Success #stdin #stdout 0s 388KB
stdin
Standard input is empty
stdout
offset of X: 12