From: Joakim Andersson Date: 2002-02-19T06:17:28+09:00 Subject: Re: Problems with Ruby in C Hi again, I must be missing something really obvious but I'm having a really hard time figuring it out. Once again I hope that someone could enlighten me. I'm doing the following with ruby 1.6.6 #include "ruby.h" int main(void) { int state = 0; ruby_init(); rb_eval_string_wrap("a = 5; puts a", &state); rb_eval_string_wrap("puts a", &state); return 0; } Which gives the following result then I run it: $ ./test6 5 5 Why does it print 5 the second time? What I thought by looking at the code for rb_eval_string_wrap was that each call to rb_eval_string_wrap would execute in its own context, in an anonymous module. But apparently that's not happening. So what should I do instead if I want each call to be executed in its own context? So that local variables would just be accessable during the call and not during later calls. /joakim -- Joakim Andersson ; tyrak@borgship.net ; http://borgship.net/~tyrak/