A small puzzle.
In a stream (TFileStream or TMemoryStream, for example), a Variant type is stored, written there from code compiled in 32-bit FPC mode. How to read the same block of memory from the 64-bit FreePascal code?
Nuance Variant in 32-bit FPC is stored in 16 bytes of memory. Variant 64-bit - 24 bytes
Are the desicion simpler and more beautiful? Is this possible without a low-level parsing of variant record memory block?
Sample code, if someone does not understand the task
Sample code compiled in 32-bit FPC where is storing variant
ASomeStream.WriteBuffer(AVariantVar, SizeOf(AVariantVar));
{ where AVariantVar is variant (ordinal type, float etc not pointer or String or TObject etc) }
Wrong sample with 64-bit FP compiler where is reading variant
ASomeStream.ReadBuffer(AVariantVar, SizeOf(AVariantVar));
{ This not right sample. Because in 32bit variant is stored in 16 bytes but in 64bit FPC compiled is stored in 24 bytes}
I understand that it's better not to save the variant in the stream. But nevertheless, how to read it?