Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
problems with 'require' in embedded ruby
James Hughes
4/29/2009 11:28:00 PM
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-...
.
1 Answer
James Hughes
4/30/2009 12:09:00 AM
0
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-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
problems with 'require' in embedded ruby
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password