On Monday 28 May 2001  9:36am, ts wrote:

> W> It seems straightforward enough, except for the fact that
> ruby_run() W> calls ruby_stop() when it finishes, which in turn calls
> exit() (which W> terminates the whole program!). This means that you
> can really only use W> ruby_run() *once* (and if you want to continue
> your program, you have W> to trap the exit...)
>
>  In this case don't run ruby_run() :-), the goal of ruby_run() is
> precisely to run only once.

Well perhaps my problem is that I was following the documentation I 
found at rubycentral. ;)

They have, under the section called "Embedding a Ruby Interpreter," 
this exact code snippet:

#include "ruby.h"

main() {
  /* ... our own application stuff ... */
  ruby_init();
  ruby_script("embedded");
  rb_load_file("start.rb");
  while (1) {
    if (need_to_do_ruby) {
      ruby_run();
    }
    /* ... run our app stuff */
  }
}

Of course, this will NOT work, as several of you have pointed out, as 
ruby_run will exit. Ah well.

Anyway, I can just use the rb_eval-type functions to get what I want 
(which is using ruby as an embedded scripting language). 

I just thought I should have been able to get a published example to 
work. ;) Is this something that used to work but has changed? Or is 
this just a bad example? (=

-- 
Wesley J. Landaker - wjl / mindless.com
http://www.landaker.net            PGP DSS/DH Key: 0x0F338E07
PGPKey FP: 3AAA 424B B488 198E B68B  C0E5 390A BACA 0F33 8E07