Problems with 'require' in embedded ruby

I'm tinkering with my first C++ app with an embedded Ruby interpreter.
I'm having trouble with pretty much any usage of 'require' that involves
a file not in the same folder as the executable. If I use rb_require, it
blows up. If I do it in the script, it blows up.

I've checked the $LOAD_PATH variable on both the C++ side and the script
side, and it's reporting the values I expect. The modules I'm requiring
are definitely in the $LOAD_PATH directories.

I'm getting a memory access error. It's mostly trying to access address
0x0. Anyone have any inkling of what's going on here? My version of Ruby
wasn't compiled with symbols, so I can't see what's going on once the
code enters the interpreter (I'm not much for wading through
disassembly).

==== c++ ====

int main(int argc, char *argv[]) {
  VALUE result;
  ruby_sysinit(&argc, &argv);
  RUBY_INIT_STACK;
  ruby_init();
  ruby_init_loadpath();
#ifdef _DEBUG
  rb_eval_string("puts $LOAD_PATH");
#endif
  rb_require("rules");

        return ruby_cleanup(0);
}

==== rules.rb ====

puts $LOAD_PATH

require 'pp'

class Rules
  def self.apply(arr_face)
    puts "array: #{arr_face.size}" if arr_face.kind_of?(Array)
    puts arr_face.pretty_inspect
    return (arr_face.size > 0) ? 1 : 0
  end
end

···

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

Sorry, forgot to mention: ruby 1.9.1-p0 compiled from source running on
Vista.

James Hughes wrote:

···

I'm tinkering with my first C++ app with an embedded Ruby interpreter.
I'm having trouble with pretty much any usage of 'require' that involves
a file not in the same folder as the executable. If I use rb_require, it
blows up. If I do it in the script, it blows up.

I've checked the $LOAD_PATH variable on both the C++ side and the script
side, and it's reporting the values I expect. The modules I'm requiring
are definitely in the $LOAD_PATH directories.

I'm getting a memory access error. It's mostly trying to access address
0x0. Anyone have any inkling of what's going on here? My version of Ruby
wasn't compiled with symbols, so I can't see what's going on once the
code enters the interpreter (I'm not much for wading through
disassembly).

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

Hi James,

Did you solve this issue? I have a similar one with Ruby 1.8.7.

Thanks,
David

James Hughes wrote:

···

Sorry, forgot to mention: ruby 1.9.1-p0 compiled from source running on
Vista.

James Hughes wrote:

I'm tinkering with my first C++ app with an embedded Ruby interpreter.
I'm having trouble with pretty much any usage of 'require' that involves
a file not in the same folder as the executable. If I use rb_require, it
blows up. If I do it in the script, it blows up.

I've checked the $LOAD_PATH variable on both the C++ side and the script
side, and it's reporting the values I expect. The modules I'm requiring
are definitely in the $LOAD_PATH directories.

I'm getting a memory access error. It's mostly trying to access address
0x0. Anyone have any inkling of what's going on here? My version of Ruby
wasn't compiled with symbols, so I can't see what's going on once the
code enters the interpreter (I'm not much for wading through
disassembly).

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