[fpc-pascal] RECORD alignment issue on Mac OS X intel based
Jonas Maebe
jonas.maebe at elis.ugent.be
Mon Apr 27 18:18:48 CEST 2009
On 27 Apr 2009, at 17:34, Roland Turcan wrote:
>> The fact is, that FPC compiler on intel based Mac OS X builds up
>> application which contains records "packed" by 4 bytes by default.
>>
>> I need to get the same behavior in intel based mac os x as I have in
>> other platforms.
If you do not specify any "packrecords" setting, the compiler can do
whatever it wants with the internal alignment of the record (and this
can be different not only between different platforms, but also
between different compiler versions). If you want a particular layout,
use a particular packrecords setting ({$packrecords 1} with manual
padding is probably the safest). See also http://wiki.freepascal.org/User_Changes_Trunk#Alignment_of_record_variables
One reason that it can be different on different platforms, is that
the alignment of some types may be defined differently by the ABI
(e.g., the Mac OS X/i386 ABI defines the alignment of double variables
as 4 bytes, while on most other ABIs it's 8 bytes).
Jonas
More information about the fpc-pascal
mailing list