Forum: JRuby [annonce] ffi-glpk extension demonstrator for jruby

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Diamantini Maurice (Guest)
on 2009-01-28 22:08
(Received via mailing list)
Le 27 janv. 09 à 22:24, Yaron Kretchmer a écrit :

> Maurice-
> Will that work with  Ruby MRI as well?
> Thanks
> Yaron
I should (or will)!

But ffi is an edge extension and some low level API still evolve.
I try it with JRuby because JRuby include it and it works out of the
box (so if you have JRuby installed it should work)

MRI Ruby still require a gem installation, and is sensible to the Ruby
version or so...
I really think MRI Ruby should include FFI natively!

For now I'v only tried the following (on MRI Ruby) :

ruby -version
  => ruby 1.8.7 (2008-08-11 patchlevel 72) [powerpc-darwin9]
    (from macport version on osx)

gem install ffi --remote

type ruby
   =>ruby is hashed (/opt/local/bin/ruby) (from macport)

ruby ffi-glpk.rb

  => ffi-glpk.rb:118:in `to_array_of_double':
     undefined method `put_array_of_double'
     for #<MemoryPointer address=0x492690 size=80> (NoMethodError)
  from ./ffi-glpk.rb:103:in `glp_load_matrix2'
  from mini_glpk.rb:61:in `glpk_test'
  from mini_glpk.rb:74

So there is a problem with MRI (in my environment).
But I'm sure it will be solve automatically whith some
future release of MRI.
(and some FFI developer are probably listening the jruby list ;-)

  Also Yaron, be aware that FFI is not yet able to do
  dynamic binding for C++ libraries, only C ones
  Why not fortran?

>> solver), C extensions (like glpk) directly in (j)ruby code.
>> The code provided is the mimimum for writing the glpk doc mini
>> example in ruby.
>> Hope this help,
>> -- Maurice Diamantini

To unsubscribe from this list, please visit:
This topic is locked and can not be replied to.