endian conversion...

Hi…

The RPC/XDR libraries are a solution to endian conversion in QNX and
Linux, but not for w$nd$s (even with cygwin installed). Do we know of
an open source library that may offer equivalent api to convert to/from
BE to LE machines? SDL offers this service, but I wonder if there is
something lighter out there… (I have some home-cooked code that does
this, but I would like to have a cleaner solution I suppose). Thanks.

Regards…

Miguel.

Miguel Simon wrote:

Hi…

The RPC/XDR libraries are a solution to endian conversion in QNX and
Linux, but not for w$nd$s (even with cygwin installed). Do we know of
an open source library that may offer equivalent api to convert to/from
BE to LE machines? SDL offers this service, but I wonder if there is
something lighter out there… (I have some home-cooked code that does
this, but I would like to have a cleaner solution I suppose). Thanks.

Did you try #include <gulliver.h>?

cheers,

Kris

Hi Kris…

XDR works well in QNX, no problem. <gulliver.h> does the tick too in
QNX. My problem is source compatible code for QNX/LINUX/cygwin. The xdr
version of cygwin is broken, and I was wondering if there is an
alternative to XDR that may be platform independent.

Thanks for your help.

Regards…

Miguel.



Kris Warkentin wrote:

Miguel Simon wrote:

Hi…

The RPC/XDR libraries are a solution to endian conversion in QNX and
Linux, but not for w$nd$s (even with cygwin installed). Do we know of
an open source library that may offer equivalent api to convert
to/from BE to LE machines? SDL offers this service, but I wonder if
there is something lighter out there… (I have some home-cooked code
that does this, but I would like to have a cleaner solution I
suppose). Thanks.


Did you try #include <gulliver.h>?

cheers,

Kris

Miguel Simon wrote:

Hi Kris…

XDR works well in QNX, no problem. <gulliver.h> does the tick too in
QNX. My problem is source compatible code for QNX/LINUX/cygwin. The xdr
version of cygwin is broken, and I was wondering if there is an
alternative to XDR that may be platform independent.

Ah…sorry. I misunderstood the problem. Unfortunately I don’t know of
anything else. However, it’s not too hard to roll your own. You’ve got
the byteswapping routines from gulliver.h. You can test with

int n = 1, bigendian = 0;

bigendian = *(char *)&n == 1

Another potential solution would be to use the htnos() type routines in
the socket library to keep everything in a common format but that’s
probably a little to heavyweight.

cheers,

Kris