On 12/12/06, Nathan Baker <nathanb / vt.edu> wrote:
> Paul-
>
> You are correct--these data can be considered arbitrary binary data
> (I'm thinking along the lines of C structs and pointers).
>
> Does this approach handle the pointer issue? We were concerned that a
> malloc'd array of, say, int pointers would serialize as a reference
> rather than the actual array of ints.
>

Pointers are not going to serialize very well. The problem is that the
machine on the receiving end most likely will not have the exact same
memory space as the machine that did the sending. A pointer on the
sender would not necessarily be a valid pointer on the receiver.

One option is to convert your C structures into Ruby Struct objects.
Those can be marshalled over a network connection. Again, special care
will need to be taken with pointers values.

If you can get all your data to map to Struct objects and fundamental
Ruby data types (Float, Integer, String), then the Marshal mechanism
will take care of endian-ness issues for you.

"For every complex problem there is a solution that is simple, neat, and wrong."
-- H. L. Mencken

Blessings,
TwP