hello_world.rb only contains: puts &quot;Hello, World!!!&quot;<br><br>hth<br>Ivan<br><br><div class="gmail_quote">On Jan 28, 2008 12:23 PM, Ivan Porto Carrero &lt;<a href="mailto:ivan@flanders.co.nz">ivan@flanders.co.nz</a>&gt; wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi Greg, <br><br>This is what i used at some point, that should still work atm.<br><br>class Program<br>
&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; static void Main(string[] args)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //TODO: review this when the hosting api changes.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IScriptEnvironment runtime = ScriptEnvironment.GetEnvironment();<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Console.WriteLine(&quot;Executing from file:&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; runtime.ExecuteFile(&quot;..\\..\\hello_world.rb&quot;);<div class="Ih2E3d">
<br>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IScriptEngine engine = IronRuby.GetEngine(runtime);<br></div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IScriptScope scope = engine.CreateScope();<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; List&lt;string&gt; strings = new List&lt;string&gt;();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strings.Add(&quot;Hello, &quot;);<br>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strings.Add(&quot;World!!!&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IronRuby.GetExecutionContext(runtime).GlobalVariables[SymbolTable.StringToId(&quot;strings&quot;)] = strings;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SourceUnit script = engine.CreateScriptSourceFromString(<br>

&nbsp;@&quot;<br>puts &quot;&quot;Hello World! There are #{$strings.count.to_s} strings:&quot;&quot;<br>$strings.each_with_index { |s,i| puts &quot;&quot;#{i}: #{s}&quot;&quot; }<br>&quot;);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Console.WriteLine(&quot;Executing from string:&quot;);<br>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; engine.Execute(scope, script);<div><div></div><div class="Wj3C7c"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br><br><br><br><div class="gmail_quote">On Jan 28, 2008 12:16 PM, Greg Akins &lt;<a href="mailto:angrygreg@gmail.com" target="_blank">angrygreg@gmail.com</a>&gt; wrote:<br>

<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">OK, so I couldn&#39;t get some of the simple examples of using RubyEngine<br>to start calling Ruby from C#...<br>

<br>So I spent a bit reading through the mailing list archives (realizing<br>while doing that, that I&#39;d asked a frequently asked question).<br><br>Now, I hope I&#39;m not asking another stupid question.<br><br>I found another post (<br>

<a href="http://rubyforge.org/pipermail/ironruby-core/2008-January/000616.html" target="_blank">http://rubyforge.org/pipermail/ironruby-core/2008-January/000616.html</a><br>) that suggests a method of running Ruby.<br><br>

However, I get an error on this line<br><br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;IScriptEngine engine = IronRuby.GetEngine(runtime);<br><br>Which shows this stack trace<br><br> &nbsp; at System.RuntimeMethodHandle._InvokeConstructor(Object[] args,<br>

SignatureStruct&amp; signature, IntPtr declaringType)<br> &nbsp; at System.RuntimeMethodHandle.InvokeConstructor(Object[] args,<br>SignatureStruct signature, RuntimeTypeHandle declaringType)<br> &nbsp; at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags<br>

invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)<br> &nbsp; at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr,<br>Binder binder, Object[] args, CultureInfo culture, Object[]<br>activationAttributes)<br>

 &nbsp; at System.Activator.CreateInstance(Type type, BindingFlags<br>bindingAttr, Binder binder, Object[] args, CultureInfo culture,<br>Object[] activationAttributes)<br> &nbsp; at System.Activator.CreateInstance(Type type, Object[] args)<br>

 &nbsp; at Microsoft.Scripting.Utils.ReflectionUtils.CreateInstance[T](Type<br>actualType, Object[] args) in<br>c:\Libraries\IronRuby\trunk\src\microsoft.scripting\Utils\ReflectionUtils.cs:line<br>127<br><br>--<br>Greg Akins<br>

Software Development Manager<br>SSI Services<br><br><a href="http://kc.vanadium.com" target="_blank">http://kc.vanadium.com</a><br><a href="http://www.pghcodingdojo.org" target="_blank">http://www.pghcodingdojo.org</a><br>

<a href="http://www.insomnia-consulting.org/monologue" target="_blank">http://www.insomnia-consulting.org/monologue</a><br>_______________________________________________<br>Ironruby-core mailing list<br><a href="mailto:Ironruby-core@rubyforge.org" target="_blank">Ironruby-core@rubyforge.org</a><br>

<a href="http://rubyforge.org/mailman/listinfo/ironruby-core" target="_blank">http://rubyforge.org/mailman/listinfo/ironruby-core</a><br></blockquote></div><br>
</div></div></blockquote></div><br>