Hi,

I am integrating Ruby with C++ on MS Windows 7 (using Visual Studio). My
code crashes when ruby_errInfo is used to get an error message after
rb_load_protect fails.

By the way, the script I am trying to load is a simple "hello world"
function and there is nothing wrong in it. But still, rb_load_protect
fails and I am unable to get details from ruby_errinfo.

Below is the relevant code snippet:

ruby_incpush (myFolder);
ruby_init_loadpath();

ruby_set_argv (argc, argv);
ruby_script (myRubyFile);

rb_load_protect (rb_str_new2(myRubyFile, 0, &status);

if (status != 0) {
    VALUE info = ruby_errinfo;
    VALUE str = rb_obj_as_string(info); // <-- crashes here
    :
}


The code crashes when info is converted into str via rb_obj_as_string().
Further investigation tells me that it's this call inside
rb_obj_as_string() which fails:

str = rb_funcall(obj, rb_intern("to_s"), 0);


Any ideas what's going on? Or how I can troubleshoot?

-- 
Posted via http://www.ruby-forum.com/.