From: "Muhammad Ali S." Date: 2013-07-11T23:52:38+09:00 Subject: Embedding Ruby in a Multi-threaded C++ Application Hi, I am trying to embed Ruby 2.0.0-p195 in a multi-threaded VC++ application for MS Windows. The same application previously made successful use of Ruby version 1.8.7-p374 without any problems but the later versions of Ruby are causing various issues. The overall approach in my C++ application hasn't changed. The way it works is that my core application loads a DLL, where I initialise Ruby in DllMain: With 1.8.7: ---------- NtInitialize (&argc, &argv); ruby_init(); With 2.0.0: --------- ruby_sysinit(&argc, &argv); RUBY_INIT_STACK; ruby_init(); I then load call the following sequence of functions in a different thread to invoke a Ruby function in a given .rb file. The code is same for 1.8.7 and 2.0.0: ruby_icnpush (pathToMyRbFile); ruby_init_loadpath(); ruby_sript (myRubyFile); rb_load_protect (rb_str_new2 (myRubyFile), 0, &status); It works for 1.8.7 but for 2.0.0 the rb_str_new2 call fails. If I check the reason I can get the class of the error but not the exact error string. The class I get is SystemStackError. Any hints/ pointers will be highly appreciated. I know this is mainly due to a multi-threaded environment. But the interesting thing is that Ruby 1.8.7 works fine with this approach. Regards, Muhammad -- Posted via http://www.ruby-forum.com/.