I think the official unsigned 32-bit integer type in Pascal is "LongWord". As others have said, be aware that pointers are 64-bit under x64... that's kind of why it's called x64! If you absolutely must have a packed record with 32-bit types, I recommend changing Sender and Target to indices that are added to a base address. Similar to what Pierre said, change your Pointer code to something like this: for Indx := 0 to SizeOf(TTCPPackageHeader) - 1 do Dec(Byte(Pointer(PtrUInt(@x) + Indx)^), ARollCount);
So similarly with your record, instead of directly derefencing Sender and Target - since I assume your record type must stay fixed at 15 bytes - have something akin to "Pointer(PtrUInt(@BaseAddr) + Sender)". The first rule, first and foremost... don't assume the Pointer is a fixed size. Hope all of this helps. Gareth aka. Kit P.S. I would recommend adding a "Filler" or "Reserved" byte at the end of your record type to make it 16 bytes long - such a size is more efficient when it's part of an array in memory. On Wed 27/03/19 21:11 , Pierre Muller pie...@freepascal.org sent: > _______________________________________________ > fpc-devel maillist - fpc-devel@lists.freepascal.org > http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel [2]">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel > > > Pointer arithmetic: > *for Indx := 0 to SizeOf(TTCPPackageHeader) - 1 do Dec(Byte(Pointer(Cardinal(@x) + Indx)^), ARollCount);* the error has nothing to do with your record, its that part: Pointer(Cardinal(@x) + Indx)^) The problem is that Cardinale is an unsigned 32-bit integer, while on 64-bit, you will need UINT64, You should use PtrUInt type that is an unsigned type that always have the size of an address instead of cardinal here! Pierre _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org [3] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel [4]">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel Links: ------ [1] mailto:fpc-devel@lists.freepascal.org [2] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel [3] mailto:fpc-devel@lists.freepascal.org [4] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
_______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel