From: Charles Mills Date: 2004-12-20T08:37:06+09:00 Subject: Re: rb_require() for strings Guilherme T. wrote: > I'd like to use rb_require(), but instead of a filename give it a > string with the contents to be required. How would I go about doing > this? > > Thanks in advance I think you want rb_eval_string() from ruby.h Basically the string you pass is evaluated by the parser. For example: rb_eval_string("puts 'hey'"); would return Qnil and print "hey\n" to standard out. Others you may want to consider: $ grep rb_eval *.h intern.h:VALUE rb_eval_cmd _((VALUE, VALUE, int)); ruby.h:VALUE rb_eval_string _((const char*)); ruby.h:VALUE rb_eval_string_protect _((const char*, int*)); ruby.h:VALUE rb_eval_string_wrap _((const char*, int*)); -Charlie