I'm trying to use BrB in a Ruby script that's called from a C++ program using an embedded Ruby interpreter. The BrB script works correctly when called from the command line. However, when it's run embedded, it gives the following error:
E, [2012-11-21T11:41:58.972989 #24529] ERROR -- : /usr/local/lib/ruby/1.9.1/thread.rb:184:in `pop'
/usr/local/lib/ruby/gems/1.9.1/gems/brb-0.3.1/lib/brb/event_machine.rb:23:in `ensure_em_is_started!'
/usr/local/lib/ruby/gems/1.9.1/gems/brb-0.3.1/lib/brb/event_machine.rb:32:in `open'
/usr/local/lib/ruby/gems/1.9.1/gems/brb-0.3.1/lib/brb/tunnel.rb:13:in `create'
/gfm/EmulatorWrapper.rb:6:in `initialize'
The script is very simple:
require 'rubygems'
require 'brb'
class EmulatorWrapper
def initialize(headerVersion)
@emulator = BrB::Tunnel.create(nil, "brb://localhost:5555")
@emulator.init(headerVersion)
end
end
I call it from C++ with:
RUBY_INIT_STACK;
ruby_init();
ruby_init_loadpath();
ruby_script("EmulatorWrapper");
rb_require("./EmulatorWrapper");
VALUE headerVersion = INT2NUM(HeaderVersionNumber);
emulator = rb_class_new_instance(1, &headerVersion, rb_const_get(rb_cObject, rb_intern("EmulatorWrapper")));
I'm using Ruby 1.9.3-p327 on Linux. The BrB server is waiting for connections and calling this script from IRB works correctly.
Does anybody have any clues please?
Thanks,
Graham