On 01:17 Thu 16 Dec     , DaZoner wrote:
> 
> I don't know very much about Ruby/DL but can't you just define a struct that 
> has two 32-bit numbers in it, and manipulate and pass those?

Well, structs in Ruby/DL are implemented as pointers to structs. You
can't create a "bare" structure in Ruby/DL (to my knowledge).

- Jamis

> 
> "Jamis Buck" <jamis_buck / byu.edu> wrote in message 
> news:20041214220549.GA15605 / serling.WorkGroup...
> > Okay, you C gurus out there. Here's a stumper.
> >
> > Is there any way, without modifying Ruby/DL itself, to specify
> > a function that returns a 64-bit integer using Ruby/DL? And to pass
> > a 64-bit integer to a function?
> >
> > Consider:
> >
> >  require 'dl/import'
> >  module Test64
> >    dlload "foo.so"
> >    extern "long long int get_64bit_value()"
> >    extern "void set_64bit_value(long long int)"
> >  end
> >
> > The above results in an error, currently, because Ruby/DL does not
> > support 64-bit integers as immediate values.
> >
> > I thought of using a double (which is 64 bits, on my platform anyway):
> >
> >  require 'dl/import'
> >  module Test64
> >    dlload "foo.so"
> >    extern "double get_64bit_value()"
> >    extern "void set_64bit_value(double)"
> >  end
> >
> >  result = Test64.get_64bit_value
> >  p [result].pack("D").unpack("LL")
> >
> > But the value that comes back is nothing like what the function itself
> > is really returning...
> >
> > Any clever tricks I can try? Anyone? Please?
> >
> > - Jamis
> >
> > -- 
> > Jamis Buck
> > jgb3 / email.byu.edu
> > http://www.jamisbuck.org/jamis
> >
> >
> > 
> 
> 
> 
> 

-- 
Jamis Buck
jgb3 / email.byu.edu
http://www.jamisbuck.org/jamis