
jotalo jotalo wrote:
Hi, I use the Bost serialization library to serialize some classes that I put in a char* variable ... I have a Server which publish this char* variable and Clients get this variable and de-serialize it to obtain the original class...
Everything work fine when servers and clients are running in machines with the same architecture (64 or 32 bits)...
But when I run the server in a 64 bits machine, the char* variable is not recognized in a 32 bits client. In this code: std::stringstream is; is.rdbuf()->pubsetbuf(c, m_StringSize); boost::archive::binary_iarchive *ia = new boost::archive::binary_iarchive(is);
The last line returns the std::exception: "invalid signature"
To be sure that I am not doing something wrong I printed the first 80 characters of this variable when it is created in a 64 bits server and a 32 bits server:
In a 64 bits machine server, the print out is:
"........serialization::archive.................MonH1F............Efficiency.(cou" (the "." are not printable ascii characters)
in Hexa format it is :
16 00 00 00 00 00 00 00 73 65 72 69 61 6C 69 7A 61 74 69 6F 6E 3A 3A 61 72 63 68 69 76 65 04 04 08 04 08 01 00 00 00 06 00 00 00 00 00 00 00 4D 6F 6E 48 31 46 00 00 00 00 1E 00 00 00 00 00 00 00 45 66 66 69 63 69 65 6E 63 79 20 28 63 6F 75
And ind the case of a 32 bits machine server, it is:
"....serialization::archive.............MonH1F........Efficiency.(counter2/counte"
16 00 00 00 73 65 72 69 61 6C 69 7A 61 74 69 6F 6E 3A 3A 61 72 63 68 69 76 65 04 04 04 04 08 01 00 00 00 06 00 00 00 4D 6F 6E 48 31 46 00 00 00 00 1E 00 00 00 45 66 66 69 63 69 65 6E 63 79 20 28 63 6F 75 6E 74 65 72 32 2F 63 6F 75 6E 74 65
They are similar but not equal...
It's pretty clear here that the 64-bit machine is using a 64-bit length and 32-bit machine is using a 32-bit length. Can you share the source of the function(s) you are using to serialize/deserialize that data? -- Jon Biggar Floorboard Software jon@floorboard.com jon@biggar.org