I am currently working on porting a piece of code written and compiled for SGI using MIPSPro to RHEL 6.7 with gcc 4.4.7. My target architecture is x86_64 I was able to generate an executable for this code and now I am trying to run it.
I am trying to read a binary data from a file, this file was generated in the SGI system by basically casting object's pointer to a char*
and saving that to a file. The piece of binary data that I am trying to read has more or less this format:
[ Header, Object A , Object B, ..., Object N ]
Where each object is an instantiation of different classes.
The way the code currently processes the file is by reading it all into memory, and taking the pointer to where the object starts and using reinterpret_class<Class A>(pointer)
to it. Something tells me that the people who original designed this were not concerned about portability.
So far I was able to deal with the endianness of the Header object by just swapping the bytes. Unfortunately, Objects A, B, .., N all contain fields of type double
and trying to do a byte-swap for 8 bytes does not seem to work.
My question then is, are doubles in SGI/MIPSPro structured differently than in Linux? I know that the sizeof(double)
in the SGI machine returns 8
so I think they are of the same size.