Hi,

From: "Stanislav Sidristij" <sunexdev / mail.ru>
>
>I have an idea (program, that uses Ruby interpreter). And I dont know 
> how to use Ruby interpreter in my program. I looking for manuals (but I 
> dont know English very well and I cannot find information about this) or 
> ideas how can I do this. If you can, please, write: is it possible to 
> use Ruby as DLL in my program?  How can I call interpreter functions and 
> how can I set (and get) variables values. And is correct to use Ruby as 
> DLL in commercial program?
> Russian programmer :)

Here's some very basic code to load and run a ruby script from C/C++

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#ifdef _WIN32
  // ruby win32 init
  int argc = 0;
  char **argv = 0;
  NtInitialize(&argc, &argv);
#endif

  ruby_init();
  ruby_script("embedded");

  // TODO - rb_str_new2 could call ruby_raise if out of memory, so we should
  // catch that possible exception here
  //
  int status;
  rb_load_protect(rb_str_new2("ruby-program.rb"), 0, &status);
  if (status == 0) {
    int state = ruby_exec();
  }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

See the README.EXT file in your Ruby installation for more info.

See also: http://metaeditor.sourceforge.net/embed/ for much more sophisticated
examples...


Hope this helps,

Regards,

Bill