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.
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?
if (status != 0) {
VALUE info = rb_errinfo();
VALUE str = rb_obj_as_string(info); // <-- crashes here
:
}
And it still crashes when I access rb_obj_as_string(). The problem seems
to be embedding Ruby in a multi-threaded environment. The same code
worked fine till Ruby 1.8.7.
Regards,
Muhammad
Ryan Davis wrote in post #1113801:
···
On Jun 27, 2013, at 04:08 , Muhammad Ali S. <lists@ruby-forum.com> > wrote:
VALUE info = ruby_errinfo;
According to the changelog, ruby_errinfo was removed in 2005... you
might want to try something more contemporary.