delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/12/24/07:17:18

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-0.1 required=5.0 tests=AWL,BAYES_50,SPF_HELO_PASS,SPF_PASS
X-Spam-Check-By: sourceware.org
X-Trace: 119772084/mk-filter-4.mail.uk.tiscali.com/B2C/$b2c-THROTTLED-DYNAMIC/b2c-CUSTOMER-DYNAMIC-IP/79.66.17.75/None/johne53 AT tiscali DOT co DOT uk
X-SBRS: None
X-RemoteIP: 79.66.17.75
X-IP-MAIL-FROM: johne53 AT tiscali DOT co DOT uk
X-MUA: Microsoft Outlook Express 6.00.2900.2180Produced By Microsoft MimeOLE V6.00.2900.2180
X-IP-BHB: Once
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: ApsEAJK2UUlPQhFL/2dsb2JhbACEVboCWJEzhkI
Message-ID: <006b01c965c1$6a7c6300$4001a8c0@mycomputer>
From: "John Emmas" <johne53 AT tiscali DOT co DOT uk>
To: <cygwin AT cygwin DOT com>
Subject: Cygwin struct alignment
Date: Wed, 24 Dec 2008 12:16:14 -0000
MIME-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Note-from-DJ: This may be spam

A program I'm building connects to a (Cygwin) server and receives the
address of a shared memory segment.  The memory contains an array of struct
and you probably know that Microsoft (by default) aligns structure members
on 8-byte boundaries (sometimes called 8-byte packing).

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).

This all seems to be going well - but I was surprised to find that I need to
compile the Windows clients using MSVC's default (8-byte) struct alignment.
I'd assumed that Cygwin probably wouldn't use structure packing (only
because I don't think Linux does).  But I only get meaningful data with
8-byte packing.  It looks as if Cygwin's compiler must default to 8-byte
packing too.  Does that make sense?

Thanks,

John 


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019