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:
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 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.
I get something like:
memcpy (&test, &something.v, 8)
for (int i = 0; i < 8; i++0
printf("[%d]: %x\n", i, test[i]);
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.