Hi All,

I have a pretty bizarre problem going on regarding Linux. Our software is running on Unix and now we are porting to Linux. The problem involves a 'double' type within a union. This double/union combo is not our software, we interface with it via them sending data over a socket. The struct looks something like this:

s
Code:
ome struct{
int type;
union
{
  char cval;
  long ival;
  double fval;
  struct
  {
    int len;
    char val[61];
  } sval;
} v;
} t_some_struct;
going from solaris to solaris, there is no problem. going from (writing from) solaris to linux (reading off the socket on linux) doesnt seem to work properly.

there is code that checks the type, then copies from the proper field in the struct to a proper type (double to double). We always get 0 in linux.

I tried to break it down by printout out byte by byte (using "v", memcpy'd into a char[8] and printed each byte). The byte by byte printout produces the same result when reading off the socket on solaris and linux. when the "fval" is looked at on solaris after reading off the socket, it looks correct. when the "fval" is looked at on linux, it is zero.

for instance

Code:
char    test[8];

memcpy (&test, &something.v, 8)
for (int i = 0; i < 8; i++0
printf("[%d]: %x\n", i, test[i]);
I get something like:
[0]: 40
[1]: 26
[2]: 72
[3]: 5a
[4]: 25
{5]: f
[6]: ffffff84
[7]:0

the double value on solaris is (in this case 11.223344. Print out the double value on linux and you get 0. But the hex dumps are the same on linux and solaris.

Is there some trick that I am missing????

I appreciate any input.

thanks,
Bill