Hi All,
I try to port a program from C to Pascal, see the following example:
#include <stdio.h>
#include <sys/socket.h>
#include <linux/if.h>
void main() {
printf("ifmap=%ld\n", sizeof(struct ifmap));
}I converted it to:
est.c test.pas
X
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?
Thanks!
