Using Delphi 10.4 and a FMX program.
I have a packed record with a "Single" type defined:
rRec = packed record
Later in the logic, I wish to display the valve of Inch as a string. There are three ways to do this:
vRec.Inch = 12.3;
vStr := FloatToStrF(vRec.Inch, ffFixed, 7, 1);
//Assign record value to variable and use TSingleHelper.ToString which simply calls FloatToStrF
s := vRec.Inch;
vStr := s.ToString(ffFixed, 7, 1);
//use TSingleHelper.ToString from the record value
//***** this fails on Android *****
vStr := vRec.Inch.ToString(ffFixed, 7, 1);
All three of the above examples work on Win10, OSX and IOS. However, the last one (vRec.Inch.ToString) fails on Android with the IDE showing the error "Project xx raised exception class error (10)" before showing an access violation. The "Bus" error appears in the IDE when I try to step into the …Inch.ToString call.
Is there a known reason TSingleHelper.ToString fails on Android when used with packed record fields? Note: I have not tested this with unpacked records, or tested the helper functions for other numeric types, or tested the TSingleHelper.ToString class function.
turns out apparently Android does not support packed records very good or at all. I noticed in my code I had three "byte" fields before the "Single" field. By adding or removing a byte field, the vRec.Inch.ToString works. Guess I will have to use FloatToStrF.