Xiangrong Fang wrote:
program test; {$mode objfpc}{$PACKRECORDS C} type ifmap = record mem_start: dword; mem_end: dword; base_addr: word; irq: byte; dma: byte; port: byte; end; begin WriteLn('ifmap=', SizeOf(ifmap)); end.The C struct's size is 24, but pascal record is 16. The ifmap struct is defined as: struct ifmap { unsigned long mem_start; unsigned long mem_end; unsigned short base_addr; unsigned char irq; unsigned char dma; unsigned char port; /* 3 bytes spare */ }; How can I instruct FPC to align records exactly same as GCC?
By using the correct types for the fields: http://www.freepascal.org/docs-html/rtl/ctypes/index-3.html
E.g., "unsigned long" is not (always) the same as "dword". Jonas _______________________________________________ fpc-pascal maillist - [email protected] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
