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