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!

Parents
  • But did you use sticky back plastic?

    Clearly define the size and endianness of the data structures being passed back an forth. Pick sizes for parameter based on their range, and the desired compactness of the structure. Decide which end need to do the least work, ie do you want a 12 MHz 8051 labouring over work a 3 GHz CPU would laugh at?

    Look at how others have solved these types of data passing concepts since the dawn of the digital age.

Reply
  • But did you use sticky back plastic?

    Clearly define the size and endianness of the data structures being passed back an forth. Pick sizes for parameter based on their range, and the desired compactness of the structure. Decide which end need to do the least work, ie do you want a 12 MHz 8051 labouring over work a 3 GHz CPU would laugh at?

    Look at how others have solved these types of data passing concepts since the dawn of the digital age.

Children