On 8/8/2015 12:30 AM, Sven Barth wrote:

Am 08.08.2015 00:37 schrieb "Ralf Quint" <freedos...@gmail.com <mailto:freedos...@gmail.com>>:
>
> On 8/6/2015 8:25 PM, Xiangrong Fang wrote:
>>
>> It seems that $packrecord does not work at all.
>
> I always explicitly use PACKED Record as in
>
> Type ifmap = PACKED Record
>                       mem_start: dword;
>                       mem_end: dword;
>                       base_addr: word;
>                       irq: byte;
>                       dma: byte;
>                       port: byte;
>              end;
>
> and at least in/up to FPC 2.6.4, this works for me just fine

This depends however on the code you're interfacing with. Also the record you mentioned as an example shouldn't differ with and without packed anyway...


I just copied and pasted the code snippet from the OP, to show how to use the PACKED Record statement explicitly for a specific record. I am using this for cross-platform/cross-compiler/cross-language software for at least 30 years now and probably for +20 years in FreePascal (when it was still called FPK and was an attempt of creating a 32bit compiler compatible with 16bit Turbo/Borland Pascal at that time)...

Beside, on the above record, the layout in fact SHOULD matter as it has 3 single bytes at the end and there for needs to be aligned on the byte, not on any word/dword/etc boundary...

Ralf

Ralf



---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to