mssip.h trouble

Ulrich Weigand weigand at
Tue Sep 10 13:16:35 CDT 2002

Patrik Stridvall wrote:

> However is the case below is does matter whether n is 4 or 8:
> #ifdef _MSC_VER
> typedef __int64 longlong_t;
> #else
> typedef long long longlong_t;
> #endif
> #pragma pack(n)
> typedef struct {
> 	char x;
> 	longlong_t y; /* offset is 4 if n = 4, but is 8 if n = 8 */
> } longlong_n;
> #pragma pack()
> In short, if the size of a field is larger than 4 it matters internally
> whether alignment is 4 or 8.

Ah, I guess I see the problem: it doesn't really have
anything to do with #pragma pack(), but with the default
alignment of the 'long long' data type itself.

GCC uses a default alignment of 4 bytes for 'long long',
so, if MSVC uses a default alignment of 8, that would be 
the problem.

However, I think you can get GCC on i386 to use a default
alignment of 8 for 8-byte sized types, by specifying the
compiler option -malign-double.  (Then you'll probably
have to use -mpreferred-stack-boundary=3 instead of
-mpreferred-stack-boundary=2 as well.)


  Dr. Ulrich Weigand
  weigand at

More information about the wine-devel mailing list