On Tue, Apr 19, 2011 at 6:30 AM, Martin Hansen <mail / maasha.dk> wrote:
> And I just discovered RubyInline! Inline code is so much easier to deal
> with that an external library IMHO. I have been messing a bit around
> with "inline", but that turns out to be some old crappy gem!!! Its not
> the first time I have missed the right gem :o( ...
>
> However, I get a peculiar error when testing RubyInline with the first
> of the examples:
>
> http://pastie.org/1811057
>
> I am on Ruby 1.9.2.

What exact version? what platform? how was it installed?

$ uname -a
Linux linux116.ctc.com 2.6.32-71.24.1.el6.x86_64 #1 SMP Fri Apr 8
01:07:23 CDT 2011 x86_64 x86_64 x86_64 GNU/Linux

$ ruby -v j.rb
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux]
120

$ cat j.rb
require "inline"

class MyTest
  inline do |builder|
    builder.c "
      long factorial(int max) {
        int i=max, result=1;
        while (i >= 2) { result *= i--; }
        return result;
      }"
  end
end

t = MyTest.new()

puts factorial_5 = t.factorial(5)