I want to call an embedded ruby function from Delphi 2009. A C or C++
example is also ok.  For example on the Ruby side:

 def myFunction(a,b,c)
   rv1=a*b -c
   rv2=a**2 + b**2
   rv3=b*c
   return rv1, rv2, rv3
  end

 The above function is just some non-sense, but hopefully easy to use as
an example. MyExample.rb contains the above script.

On the Delphi side:

Starting with:

fState := 0;
ruby_init;
ruby_init_loadpath;
rb_set_safe_level(0);
ruby_script('embedded'); // or should it be ruby_script(???ruby???)


Ok now I have no clue as to what top do next. Somehow MyExample.rb must
be loaded.

Maybe:
rb_load_file(???MyExample.rb???) ???

Next call myFunction(a,b,c) ???

I found rb_funcall2 and VALUE is defined as:  typedef unsigned long
VALUE
However I do not have documentation that explains the meaning of recv or
how to get the parameter for recv.



VALUE rb_funcall2(VALUE recv,
    ID   mid,
    int   argc,
    const VALUE *   argv
           )


Any help or suggestions are appreciated.
-- 
Posted via http://www.ruby-forum.com/.