Setting __FILE__ impossible with rb_eval_string() - hack ide

In the following C code:

int main(const int argc, const char ** argv){
ruby_init();
ruby_init_loadpath();
ruby_script(argv[0]);
ruby_sourcefile = rb_source_filename(argv[0]);
rb_eval_string(“puts FILE”); /* → returns (eval) wanted
argv[0] */
rb_eval_string(“puts $0”);
return 0;
}

my attempts to to set a value for FILE fail because rb_eval_string
resets it to “(eval)” every time as shown below:

----- eval.c -----
01600 VALUE
01601 rb_eval_string(str)
01602 const char *str;
01603 {
01604 VALUE v;
01605 NODE *oldsrc = ruby_current_node;
01606
01607 ruby_current_node = 0;
01608 ruby_sourcefile = rb_source_filename(“(eval)”);
01609 v = eval(ruby_top_self, rb_str_new2(str), Qnil, 0, 0);
01610 ruby_current_node = oldsrc;
01611
01612 return v;
01613 }

Can anyone suggest a clever hack ( C novice here ) so that I can reset
FILE to argv[0]? I thought that perhaps I could just call eval
directly but I can’t seem to grab ruby_top_self from within the
context of my application, but I am a C ignoramus so I may be missing
something obvious.

I’d be grateful for any pointers (he, he).

John-Mason Shackelford

Software Developer
Pearson Educational Measurement

2510 North Dodge St.
Iowa City, IA 52245
ph. 319-354-9200x6214
[email protected]
http://pearsonedmeasurement.com