Mail Archives: djgpp/2001/04/19/03:49:27
On 18 Apr 2001, at 20:32, echo 'Rudolf Polzer' wrote:
> > > > > So it looks like -fpack-struct does work, at least in 2.95.3.
> > > >
> > > > With my test case I'm getting following results:
> > > >
> > > > DJGPP port of gcc-2.95.3 : doen't work
> > >
> > > This is _really_ strange: how come the same binary yields different
> > > results? Does the bug depend on the struct layout perhaps?
> > >
> > > I also don't understand why are there differences between MinGW, DJGPP,
> > > and GNU/Linux for the same GCC version: these all target the same
> > > processor, so the alignment of struct fields should be the same, no?
> >
> > Well it seems to work with C but not with C++ (I tested C++ first). The
> > same under Linux.
> >
> > For MINGW and with gcc-3.0 prerelease -fpack-struct works both for
> > C and C++
>
> What happens if you declare and define the structure as extern "C"?
> Does that work?
>
No. It doesn't work for C++. So best I can currently suggest is to avoid
using broken -fpack-struct and use pair of #pragma pack(1) and
#pragma pack() where needed. This is better as You can pack only
those structures You really need.
Andris
- Raw text -