How to setup global variables in CLR that could be accessed by scripts running in Iron Ruby engine hosted in CLR.
Some posts referred to the API Runtime.GetCurrentExecutionContext and then setting up global variables there but in IronRuby version 1.1.3 this API is missing. Ruby Script code (Test.rb): class Test def DoSomething() puts "Value of global variable is #{$gVar}" end end C# code: // setup runtime etc engine = runtime.GetEngine("IronRuby"); // setup global variables // something like gVar = "Hello IronRuby" scriptSource = engine.CreateScriptSourceFromFile(scriptFile) scriptSource.Execute() object myType = engine.Runtime.Globals.GetVariable(“Test”); // Create a class instance object myTypeObj = engine.Operations.CreateInstance(myType); // Execute method object result = engine.Operations.InvokeMember(myTypeObj, “doSomething”); Any help is greatly appreciated. Thank you, Ramesh -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core