View topic - endian conversion...

endian conversion...

Read-only archive of qnx.cafe (generail discussion forum) at inn.qnx.com

endian conversion...

Postby Miguel Simon » Wed Aug 25, 2004 2:01 pm

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
 

Re: endian conversion...

Postby Kris Warkentin » Wed Aug 25, 2004 5:06 pm

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
Kris Warkentin
 

Re: endian conversion...

Postby Miguel Simon » Wed Aug 25, 2004 6:18 pm

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
 

Re: endian conversion...

Postby Kris Warkentin » Thu Aug 26, 2004 1:36 pm

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
Kris Warkentin
 


Return to qnx.cafe

Who is online

Users browsing this forum: No registered users and 1 guest

cron