Cygwin struct alignment

Ralph Hempel
Mon Dec 29 18:45:00 GMT 2008

John Emmas wrote:
> Christopher / Reini - thanks for your tips.

John, here's a quote from your original email:

 > As things stand, both client and server use System V shared memory and
 > everything works well if I compile under Cygwin or Linux.  Ultimately
 > however, there'll be no Linux clients.  The clients will either be
 > Cygwin clients or Windows clients.  Therefore I'm currently
 > experimenting to see if I can change the server to use Windows shared
 > memory (only under Cygwin of course - not for Linux use).

I'll repeat my original statement, which is that you will run screaming
from your workstation before you will make two separate compilers
understand each other's structure packing and struct alignment

You might end up packing individual structs OK, but nested structs may
end up aligned on full 32 or 64 bit boundaries again.

I've been through this with HC16 and Blackfin processors, and I'm
running into it with ARM devices too.

However close you get to the Rosetta Stone of compiler settings, there
will be corner cases that will not work, and you'll have a hell of a
time tracking down the errors.

Have a close look at the RFC I pointed you to, and see if it can help.
Even if you just play with it for fun, there will be another tool
in your belt when you're done.


Unsubscribe info:
Problem reports:

More information about the Cygwin mailing list