From owner-freebsd-hackers Mon Mar 10 13:32:55 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id NAA26212 for hackers-outgoing; Mon, 10 Mar 1997 13:32:55 -0800 (PST) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.50]) by freefall.freebsd.org (8.8.5/8.8.5) with SMTP id NAA26203 for ; Mon, 10 Mar 1997 13:32:45 -0800 (PST) Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id OAA23550; Mon, 10 Mar 1997 14:24:31 -0700 From: Terry Lambert Message-Id: <199703102124.OAA23550@phaeton.artisoft.com> Subject: Re: Structure member alignment To: zellion@cyberwind.com (Jeffery T. White) Date: Mon, 10 Mar 1997 14:24:31 -0700 (MST) Cc: freebsd-hackers@freebsd.org In-Reply-To: <199703100410.UAA17876@shell.wco.com> from "Jeffery T. White" at Mar 9, 97 08:18:41 pm X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > I am writing a client server system with FreeBSD as the client. I would > like the clients [Windoze] to communicate with the server by sending > packets which are actually structures whose definitions both systems use. > In Windows the structure member alignment can be controlled using the > pack(x) pragma. so they can be byte/word/whatever aligned. > > 1. Is there a way to control this in FreeBSD? #pragma packing(1) > 2. If not is there a standard way [byte/word/etc.] that FreeBSD does this > that I can count on across all CPUs [386/486/Pentium]. Is this something > that might change in the future? There is also __attrib, a GCC specific thing. The #pragma packing() is the same as Microsoft, but GCC has a penchant for ignoring #pragma wherever possible (not here though, even though it isn't really documented as working). There are also various compile flags for structure alignment, etc.. > I know what I am writing would likely be difficult to port to other OSes. Yes. You should consider RPC (network word order) or DCE RPC (host word order with word order tags) instead to make it more portable. You can download DCOM for Windows95 from the Microsoft developer forum on their www site. DCOM is built on top of DCE RPC. A full specification for DCOM is there as well. Regards, Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.