On 12/12/06, ara.t.howard / noaa.gov <ara.t.howard / noaa.gov> wrote:
> 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.
>

Hmmm ... are you suggesting that he memory map all the C data to a
file and then send the file over the network to the receiving machine?

TwP