I was just eyeballing through the Ruby source trying to evaluate it
for use and came across the following code:
void
Init_stack(addr)
VALUE *addr;
{
#if defined(__human68k__)
extern void *_SEND;
rb_gc_stack_start = _SEND;
#else
VALUE start;
if (!addr) addr = &start;
rb_gc_stack_start = addr;
#endif
}
This is called from ruby_init() and ruby_run() and the resulting
value is used in scanning for potential Ruby objects on the native
stack (which is an interesting idea).
Now, the part that confuses me are things like rb_funcall(). This
appears to NOT update the stack base. So, it seems like it is invalid
to call rb_funcall() directly (but you could call it if Ruby calls you
via a Ruby->C binding). Instead, it seems like you must always call
ruby_run() at the top level (which really limits the usefulness of the
embedding API).
What is the intended semantic of rb_funcall()? I don't see any
documentation that would lead me to believe that I can't call it
directly after loading a script.
-tim