Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Mar 1997 14:24:31 -0700 (MST)
From:      Terry Lambert <terry@lambert.org>
To:        zellion@cyberwind.com (Jeffery T. White)
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Structure member alignment
Message-ID:  <199703102124.OAA23550@phaeton.artisoft.com>
In-Reply-To: <199703100410.UAA17876@shell.wco.com> from "Jeffery T. White" at Mar 9, 97 08:18:41 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> 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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199703102124.OAA23550>