AIX endian problems

Tom Coleman tcoleman at
Mon Jul 10 11:54:28 EDT 2000

I've compiled the tds library on AIX 4.3.2.  This is big endian hardware.

Autoconf defines both HW_BIG_ENDIAN and WORDS_BIGENDIAN.

While the tds unittests all report success, the "sample" tdstest.c
program fails.  The dumps all include the following message:

  The token datastream length was not correct.  This is an internal
  protocol error.

The only way I've been able to get the test programs to work correctly
on AIX is to #undef HW_BIG_ENDIAN and #define HW_LITTLE_ENDIAN in 

This forces the same byte ordering I test with using a Linux reference

I then have to swap 2 and 4-byte integer bytes (#ifdef WORDS_BIGENDIAN)
using standard byte-swapping macros. 

I've read through the mailing list.  I see endian problems reported but
haven't seen what looks like any definite solutions.

I'd appreciate any light that anyone might be able to shed on this 



More information about the FreeTDS mailing list