Path: utzoo!attcan!uunet!lll-winken!ames!sgi!brendan@illyria.SGI.COM From: brendan@illyria.SGI.COM (Brendan Eich) Newsgroups: comp.sys.sgi Subject: Re: Binary Compatability? Summary: xdr_double bugfix Message-ID: <27668@sgi.SGI.COM> Date: 28 Feb 89 19:38:04 GMT References: <8902260158.aa09669@SPARK.BRL.MIL> <27653@sgi.SGI.COM> Sender: daemon@sgi.SGI.COM Organization: Silicon Graphics, Inc., Mountain View, CA Lines: 39 The bug arose because Sun's xdr_float.c routines are conditionally compiled to do no conversion #if mc68000, and to do IEEE-to-DEC conversion otherwise. Alas, when the code was ported to the 3000 (68xxx-based machines as you no doubt know), mc68000 was assumed to be defined. It isn't; m68000 is (sigh). Lack of heterogeneous testing allowed both the 3.5 and 3.6 releases to ship with xdr_float and xdr_double converting the 3000's native floating point representations to DEC format on the wire, and back again. Of course it doesn't work so well with other vendor's machines. The fix is to write your own xdr_float and xdr_double: bool_t xdr_float(xdrs, fp) XDR *xdrs; float *fp; { return xdr_long(xdrs, (long *)fp); } bool_t xdr_double(xdrs, dp) XDR *xdrs; double *dp; { return xdr_opaque(xdrs, (caddr_t)dp, sizeof *dp); } Put the above functions with the necessary includes in xdr_float.c, compile to xdr_float.o, and utter ar rv /usr/lib/libsun.a xdr_float.o; ranlib /usr/lib/libsun.a to install the fix. (These functions could be optimized to use XDR_PUTLONG and XDR_GETLONG.) Brendan Eich Silicon Graphics, Inc. brendan@sgi.com