[fpc-devel] JWA 64-bit struct packing
Marco van de Voort
fpc at pascalprogramming.org
Thu May 14 23:48:00 CEST 2020
Op 2020-05-14 om 17:03 schreef Henry Vermaak via fpc-devel:
>> The original headers only did 32-bit. Over the years some 64-bit
>> corrections have been added. This process is ongoing, so please make
>> sure you use the newest version.
> Grepping for align|packrecords give exactly the same results in trunk,
> afaics. jwawindows.pas explicitly sets align 4.
jwawindows.pas
{$ALIGN 4}
{$ALIGN 4}
jwawinldap.pas
{$ALIGN ON}
jwawinsock2.pas
{$ALIGN 4}
jwaws2atm.pas
{$ALIGN ON}
jwaws2spi.pas
{$ALIGN OFF}
{$ALIGN ON}
But yeah, that looks bad.
>
>> I'm a bit loath to try to fix this with big, overarching $packrecords,
>> because the winapi actually sometimes uses packrecords C and sometimes
>> packrecords 8.
> So why is rtl/win*/* full of packrecords c? These pages say that the
> Windows API expect 8:
>
> https://docs.microsoft.com/en-us/windows/win32/winprog/using-the-windows-headers#controlling-structure-packing
> https://docs.microsoft.com/en-gb/cpp/build/reference/zp-struct-member-alignment
Those are probably the exceptions then. But jwa* is delphi compat, so
can't use $PUSH/$POP, so changing defaults is less useful, since it will
be undone at the first exception
More information about the fpc-devel
mailing list