Hi,

We embedded Ruby 1.3.29 in a Windows XP application, and sometimes we
get strange errors back from the Ruby interpreter.

The error we get is something like:
#<Errno::EBADF: (eval):3702:in `write'Bad file descriptor>
Where the number (3709) varies.

I attached a code snippet in C++ where we make the actually call to
Ruby.
The Ruby script does not use OS resources like files or sockets, we only
do some numerical processing there.

I wonder if the eval() tries to open a file? Maybe for logging or
something similar. Any ideas?

Thanks,
Luc

bool ApplyScript (const string &inScript, string& outErrorString)
{
    int theState = 0;
    rb_eval_string_protect (inScript.c_str (), &theState);

    if (theState) {
        string errorString = STR2CSTR (rb_obj_as_string
(rb_inspect(ruby_errinfo)));
        rb_p (ruby_errinfo);
        outErrorString = errorString;
        return false;
    }
    return true;
}
-- 
Posted via http://www.ruby-forum.com/.