From: ara.t.howard@... Date: 2006-12-13T08:19:43+09:00 Subject: Re: C => Ruby plus TCP serialization using Marshal.dump/load On Wed, 13 Dec 2006, Nathan Baker wrote: > Hey, > > We are writing an application that gets data from a C library, passes > it through our Ruby framework and over the network, and then sends > those data back down into the C library. We don't actually want to > manipulate the data in Ruby, but we do want to be able to store them in > an opaque blob and have them marshal correctly and arrive intact. It is > also worth noting that we are trying to produce a generic framework, so > we want to make no assumptions about the sort of data we might be > getting from C. > > What is the best way to do this? We tried the naive approach, using > Data_Wrap_Struct to pass the data into Ruby and then Data_Get_Struct to > move the data back down to C, but then when we tried to serialize it > using Marshal.dump, it failed (no marshal_dump is defined for class > Object). > > Is there a relatively painless way to wrap data and pass them to Ruby > in such a way that these data can then be serialized over the network? > > Thanks, > Nathan i think you really want to be using mmap. that way there is no 'passing'. the interface to mmap is as a string, so joel's comments there apply. mmap is avialible on nix or windoze. cheers. -a -- if you find yourself slandering anybody, first imagine that your mouth is filled with excrement. it will break you of the habit quickly enough. - the dalai lama