Say I have a record type defined like this:
TAppData = packed record //Total 8 bytes per app
ActiveToken: word; //Matches constant for app if active
Option: word; //16 option bits
ExpDate: word; //Integer TDateTime values
Info: word; //16 info bits
end;The data is stored in a security dongle memory which can be accessed only a word at a time by its word address 0..55.
I want to write my code such that the address to the individual member is calculated automatically so if the record type is modified it will still work.
So far I have this for the setter:
//Info is 4th member of record
address := AppBase + (AppNumber -1) * (SizeOf(TAppData) div 2) + 3;
WriteMemory(address, Value);Appbase is defined in a global constants unit as where the array of app records in dongle memory starts.
While programming I have found that mistakes are easy if fixed offset constants are used, like 3 in the example.
Is there some way to get the address within the record of a member value?
