This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Remote procedure call - x86 to 8051 etc.

I am writing a system to allow remote procedure calls. I want to make sure that it would be platform independent as possible, so that if I pack an integer on a x86-64 machine (4 or 8 bytes), the generated unpacking code on the target, which can be a 8051 (int is 2 bytes) will still be able to correctly handle this. So my issue is that "int" and "long" have different meaning on different platforms.
I thought of writing a generic integer packer (and support other types) than accept a void pointer and the width of the data pointed to. It will then call htonl() onto the memory location and copy it to the buffer.
The unpacker needs to do the other way around, but I am not entirely sure what to do if the data does not fit the available native type.
Any thought will be much appreciated!

0