[fpc-pascal] Problem with c header conversion
gabor
gabor at poczta.onet.pl
Sat Jan 3 12:54:23 CET 2009
Hello,
I'm trying to convert c header code from "Windows Mobile API 5" to
pascal and I'm getting wrong size of converted record:
original c header:
typedef struct _DDPIXELFORMAT
{
DWORD dwSize;
DWORD dwFlags;
DWORD dwFourCC;
union
{
DWORD dwRGBBitCount;
DWORD dwYUVBitCount;
DWORD dwAlphaBitDepth;
};
union
{
DWORD dwRBitMask;
DWORD dwYBitMask;
};
union
{
DWORD dwGBitMask;
DWORD dwUBitMask;
};
union
{
DWORD dwBBitMask;
DWORD dwVBitMask;
};
union
{
DWORD dwRGBAlphaBitMask;
};
} DDPIXELFORMAT, * LPDDPIXELFORMAT;
and my pascal conversion:
PDDPixelFormat = ^TDDPixelFormat;
_DDPIXELFORMAT = record
dwSize: DWORD;
dwFlags: DWORD;
dwFourCC: DWORD;
case Integer of
0: (
dwRGBBitCount : DWORD;
dwYUVBitCount : DWORD;
dwAlphaBitDepth : DWORD;
);
1: (
dwRBitMask : DWORD;
dwYBitMask : DWORD;
);
2: (
dwGBitMask : DWORD;
dwUBitMask : DWORD;
);
3: (
dwBBitMask : DWORD;
dwVBitMask : DWORD;
);
4: (
dwRGBAlphaBitMask: DWORD;
);
end;
DDPIXELFORMAT = _DDPIXELFORMAT;
TDDPixelFormat = _DDPIXELFORMAT;
embedded visual c++ 4 returns sizeof(_DDPIXELFORMAT) = 32
free pascal 2.2.2 arm/wince target returns sizeof(_DDPIXELFORMAT) = 24
When I retrive these structure from Windows, field dwSize = 32
Where is problem? Maybe I shuld use special compiler directive or switch?
Michal
p.s. sorry for my bad english
More information about the fpc-pascal
mailing list