OK, so I couldn''t get some of the simple examples of using RubyEngine to start calling Ruby from C#... So I spent a bit reading through the mailing list archives (realizing while doing that, that I''d asked a frequently asked question). Now, I hope I''m not asking another stupid question. I found another post ( http://rubyforge.org/pipermail/ironruby-core/2008-January/000616.html ) that suggests a method of running Ruby. However, I get an error on this line IScriptEngine engine = IronRuby.GetEngine(runtime); Which shows this stack trace at System.RuntimeMethodHandle._InvokeConstructor(Object[] args, SignatureStruct& signature, IntPtr declaringType) at System.RuntimeMethodHandle.InvokeConstructor(Object[] args, SignatureStruct signature, RuntimeTypeHandle declaringType) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at System.Activator.CreateInstance(Type type, Object[] args) at Microsoft.Scripting.Utils.ReflectionUtils.CreateInstance[T](Type actualType, Object[] args) in c:\Libraries\IronRuby\trunk\src\microsoft.scripting\Utils\ReflectionUtils.cs:line 127 -- Greg Akins Software Development Manager SSI Services http://kc.vanadium.com http://www.pghcodingdojo.org http://www.insomnia-consulting.org/monologue
Hi Greg, This is what i used at some point, that should still work atm. class Program { static void Main(string[] args) { //TODO: review this when the hosting api changes. IScriptEnvironment runtime = ScriptEnvironment.GetEnvironment(); Console.WriteLine("Executing from file:"); runtime.ExecuteFile("..\\..\\hello_world.rb"); IScriptEngine engine = IronRuby.GetEngine(runtime); IScriptScope scope = engine.CreateScope(); List<string> strings = new List<string>(); strings.Add("Hello, "); strings.Add("World!!!"); IronRuby.GetExecutionContext(runtime).GlobalVariables[ SymbolTable.StringToId("strings")] = strings; SourceUnit script = engine.CreateScriptSourceFromString( @" puts ""Hello World! There are #{$strings.count.to_s} strings:"" $strings.each_with_index { |s,i| puts ""#{i}: #{s}"" } "); Console.WriteLine("Executing from string:"); engine.Execute(scope, script); } } On Jan 28, 2008 12:16 PM, Greg Akins <angrygreg at gmail.com> wrote:> OK, so I couldn''t get some of the simple examples of using RubyEngine > to start calling Ruby from C#... > > So I spent a bit reading through the mailing list archives (realizing > while doing that, that I''d asked a frequently asked question). > > Now, I hope I''m not asking another stupid question. > > I found another post ( > http://rubyforge.org/pipermail/ironruby-core/2008-January/000616.html > ) that suggests a method of running Ruby. > > However, I get an error on this line > > IScriptEngine engine = IronRuby.GetEngine(runtime); > > Which shows this stack trace > > at System.RuntimeMethodHandle._InvokeConstructor(Object[] args, > SignatureStruct& signature, IntPtr declaringType) > at System.RuntimeMethodHandle.InvokeConstructor(Object[] args, > SignatureStruct signature, RuntimeTypeHandle declaringType) > at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags > invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) > at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, > Binder binder, Object[] args, CultureInfo culture, Object[] > activationAttributes) > at System.Activator.CreateInstance(Type type, BindingFlags > bindingAttr, Binder binder, Object[] args, CultureInfo culture, > Object[] activationAttributes) > at System.Activator.CreateInstance(Type type, Object[] args) > at Microsoft.Scripting.Utils.ReflectionUtils.CreateInstance[T](Type > actualType, Object[] args) in > > c:\Libraries\IronRuby\trunk\src\microsoft.scripting\Utils\ReflectionUtils.cs:line > 127 > > -- > Greg Akins > Software Development Manager > SSI Services > > http://kc.vanadium.com > http://www.pghcodingdojo.org > http://www.insomnia-consulting.org/monologue > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/ironruby-core/attachments/20080128/ca6268e5/attachment.html
hello_world.rb only contains: puts "Hello, World!!!" hth Ivan On Jan 28, 2008 12:23 PM, Ivan Porto Carrero <ivan at flanders.co.nz> wrote:> Hi Greg, > > This is what i used at some point, that should still work atm. > > class Program > { > static void Main(string[] args) > { > //TODO: review this when the hosting api changes. > IScriptEnvironment runtime = ScriptEnvironment.GetEnvironment > (); > > Console.WriteLine("Executing from file:"); > runtime.ExecuteFile("..\\..\\hello_world.rb"); > > IScriptEngine engine = IronRuby.GetEngine(runtime); > IScriptScope scope = engine.CreateScope(); > > List<string> strings = new List<string>(); > strings.Add("Hello, "); > strings.Add("World!!!"); > IronRuby.GetExecutionContext(runtime).GlobalVariables[ > SymbolTable.StringToId("strings")] = strings; > > SourceUnit script = engine.CreateScriptSourceFromString( > @" > puts ""Hello World! There are #{$strings.count.to_s} strings:"" > $strings.each_with_index { |s,i| puts ""#{i}: #{s}"" } > "); > > Console.WriteLine("Executing from string:"); > engine.Execute(scope, script); > > } > } > > > > On Jan 28, 2008 12:16 PM, Greg Akins <angrygreg at gmail.com> wrote: > > > OK, so I couldn''t get some of the simple examples of using RubyEngine > > to start calling Ruby from C#... > > > > So I spent a bit reading through the mailing list archives (realizing > > while doing that, that I''d asked a frequently asked question). > > > > Now, I hope I''m not asking another stupid question. > > > > I found another post ( > > http://rubyforge.org/pipermail/ironruby-core/2008-January/000616.html > > ) that suggests a method of running Ruby. > > > > However, I get an error on this line > > > > IScriptEngine engine = IronRuby.GetEngine(runtime); > > > > Which shows this stack trace > > > > at System.RuntimeMethodHandle._InvokeConstructor(Object[] args, > > SignatureStruct& signature, IntPtr declaringType) > > at System.RuntimeMethodHandle.InvokeConstructor(Object[] args, > > SignatureStruct signature, RuntimeTypeHandle declaringType) > > at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags > > invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) > > at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, > > Binder binder, Object[] args, CultureInfo culture, Object[] > > activationAttributes) > > at System.Activator.CreateInstance(Type type, BindingFlags > > bindingAttr, Binder binder, Object[] args, CultureInfo culture, > > Object[] activationAttributes) > > at System.Activator.CreateInstance(Type type, Object[] args) > > at Microsoft.Scripting.Utils.ReflectionUtils.CreateInstance[T](Type > > actualType, Object[] args) in > > > > c:\Libraries\IronRuby\trunk\src\microsoft.scripting\Utils\ReflectionUtils.cs:line > > 127 > > > > -- > > Greg Akins > > Software Development Manager > > SSI Services > > > > http://kc.vanadium.com > > http://www.pghcodingdojo.org > > http://www.insomnia-consulting.org/monologue > > _______________________________________________ > > Ironruby-core mailing list > > Ironruby-core at rubyforge.org > > http://rubyforge.org/mailman/listinfo/ironruby-core > > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/ironruby-core/attachments/20080128/70f7e867/attachment-0001.html
I''m actually getting ready to work on an IronRuby quick start blog post, based on my experiences, but this is the simplest "hello world" using the hosting mechanism I could come up with: using System; using Ruby.Runtime; using Microsoft.Scripting.Hosting; namespace RubyExample { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { IScriptEnvironment scriptenvironment ScriptEnvironment.GetEnvironment(); IScriptEngine rubyengine = scriptenvironment.GetEngine("ruby"); scriptenvironment.ExecuteSourceUnit(rubyengine.CreateScriptSourceFromString("puts ''Hello World!\nPress Any Key To Continue..''") ); Console.ReadKey(); } } } be sure to add references to Microsof.Scripting.dll and IronRuby.dll (and IronRuby.Libraries.dll if you''re so inclined). You can also use scriptenvironment.ExecuteFile(pathtofile) if you have your ruby script inn a standalone file. On Jan 27, 2008 6:16 PM, Greg Akins <angrygreg at gmail.com> wrote:> OK, so I couldn''t get some of the simple examples of using RubyEngine > to start calling Ruby from C#... > > So I spent a bit reading through the mailing list archives (realizing > while doing that, that I''d asked a frequently asked question). > > Now, I hope I''m not asking another stupid question. > > I found another post ( > http://rubyforge.org/pipermail/ironruby-core/2008-January/000616.html > ) that suggests a method of running Ruby. > > However, I get an error on this line > > IScriptEngine engine = IronRuby.GetEngine(runtime); > > Which shows this stack trace > > at System.RuntimeMethodHandle._InvokeConstructor(Object[] args, > SignatureStruct& signature, IntPtr declaringType) > at System.RuntimeMethodHandle.InvokeConstructor(Object[] args, > SignatureStruct signature, RuntimeTypeHandle declaringType) > at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags > invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) > at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, > Binder binder, Object[] args, CultureInfo culture, Object[] > activationAttributes) > at System.Activator.CreateInstance(Type type, BindingFlags > bindingAttr, Binder binder, Object[] args, CultureInfo culture, > Object[] activationAttributes) > at System.Activator.CreateInstance(Type type, Object[] args) > at Microsoft.Scripting.Utils.ReflectionUtils.CreateInstance[T](Type > actualType, Object[] args) in > c:\Libraries\IronRuby\trunk\src\microsoft.scripting\Utils\ReflectionUtils.cs:line > 127 > > -- > Greg Akins > Software Development Manager > SSI Services > > http://kc.vanadium.com > http://www.pghcodingdojo.org > http://www.insomnia-consulting.org/monologue > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core >-- Michael Letterle [Polymath Programmer] http://michaeldotnet.blogspot.com
Hi Michael I think we can work together for that, seen as I will have a bunch of samples I''m writing for the book I haven''t gotten round to putting a website/blog up because most of the CMS/blog systems out there don''t do exactly what I want (which is not much). I want it to be ruby of course. Email me off list if you like the idea? Cheers Ivan On Jan 28, 2008 12:34 PM, Michael Letterle <michael.letterle at gmail.com> wrote:> I''m actually getting ready to work on an IronRuby quick start blog > post, based on my experiences, but this is the simplest "hello world" > using the hosting mechanism I could come up with: > > using System; > using Ruby.Runtime; > using Microsoft.Scripting.Hosting; > namespace RubyExample > { > static class Program > { > /// <summary> > /// The main entry point for the application. > /// </summary> > [STAThread] > static void Main() > { > IScriptEnvironment scriptenvironment > ScriptEnvironment.GetEnvironment(); > IScriptEngine rubyengine = scriptenvironment.GetEngine("ruby"); > scriptenvironment.ExecuteSourceUnit( > rubyengine.CreateScriptSourceFromString("puts > ''Hello World!\nPress Any Key To Continue..''") ); > Console.ReadKey(); > > } > } > } > > be sure to add references to Microsof.Scripting.dll and IronRuby.dll > (and IronRuby.Libraries.dll if you''re so inclined). > > You can also use scriptenvironment.ExecuteFile(pathtofile) if you have > your ruby script inn a standalone file. > > On Jan 27, 2008 6:16 PM, Greg Akins <angrygreg at gmail.com> wrote: > > OK, so I couldn''t get some of the simple examples of using RubyEngine > > to start calling Ruby from C#... > > > > So I spent a bit reading through the mailing list archives (realizing > > while doing that, that I''d asked a frequently asked question). > > > > Now, I hope I''m not asking another stupid question. > > > > I found another post ( > > http://rubyforge.org/pipermail/ironruby-core/2008-January/000616.html > > ) that suggests a method of running Ruby. > > > > However, I get an error on this line > > > > IScriptEngine engine = IronRuby.GetEngine(runtime); > > > > Which shows this stack trace > > > > at System.RuntimeMethodHandle._InvokeConstructor(Object[] args, > > SignatureStruct& signature, IntPtr declaringType) > > at System.RuntimeMethodHandle.InvokeConstructor(Object[] args, > > SignatureStruct signature, RuntimeTypeHandle declaringType) > > at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags > > invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) > > at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, > > Binder binder, Object[] args, CultureInfo culture, Object[] > > activationAttributes) > > at System.Activator.CreateInstance(Type type, BindingFlags > > bindingAttr, Binder binder, Object[] args, CultureInfo culture, > > Object[] activationAttributes) > > at System.Activator.CreateInstance(Type type, Object[] args) > > at Microsoft.Scripting.Utils.ReflectionUtils.CreateInstance[T](Type > > actualType, Object[] args) in > > > c:\Libraries\IronRuby\trunk\src\microsoft.scripting\Utils\ReflectionUtils.cs:line > > 127 > > > > -- > > Greg Akins > > Software Development Manager > > SSI Services > > > > http://kc.vanadium.com > > http://www.pghcodingdojo.org > > http://www.insomnia-consulting.org/monologue > > _______________________________________________ > > Ironruby-core mailing list > > Ironruby-core at rubyforge.org > > http://rubyforge.org/mailman/listinfo/ironruby-core > > > > > > -- > Michael Letterle > [Polymath Programmer] > http://michaeldotnet.blogspot.com > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/ironruby-core/attachments/20080128/3e7b8fdc/attachment.html
Thanks to both of you. I''ll try those approaches. Incidentally, the line which threw my error was in Microsoft.Scripting.Hosting.PlatformAdaptationLayer at line 90 #if !SILVERLIGHT return Assembly.Load(name); <== ERROR OCCURRED ON THIS LINE while "name" == "IronRuby.Libraries" #else return Assembly.Load(LookupFullName(name)); #endif On Jan 27, 2008 6:34 PM, Michael Letterle <michael.letterle at gmail.com> wrote:> I''m actually getting ready to work on an IronRuby quick start blog > post, based on my experiences, but this is the simplest "hello world" > using the hosting mechanism I could come up with: > > using System; > using Ruby.Runtime; > using Microsoft.Scripting.Hosting; > namespace RubyExample > { > static class Program > { > /// <summary> > /// The main entry point for the application. > /// </summary> > [STAThread] > static void Main() > { > IScriptEnvironment scriptenvironment > ScriptEnvironment.GetEnvironment(); > IScriptEngine rubyengine = scriptenvironment.GetEngine("ruby"); > scriptenvironment.ExecuteSourceUnit(rubyengine.CreateScriptSourceFromString("puts > ''Hello World!\nPress Any Key To Continue..''") ); > Console.ReadKey(); > > } > } > } > > be sure to add references to Microsof.Scripting.dll and IronRuby.dll > (and IronRuby.Libraries.dll if you''re so inclined). > > You can also use scriptenvironment.ExecuteFile(pathtofile) if you have > your ruby script inn a standalone file. > > > On Jan 27, 2008 6:16 PM, Greg Akins <angrygreg at gmail.com> wrote: > > OK, so I couldn''t get some of the simple examples of using RubyEngine > > to start calling Ruby from C#... > > > > So I spent a bit reading through the mailing list archives (realizing > > while doing that, that I''d asked a frequently asked question). > > > > Now, I hope I''m not asking another stupid question. > > > > I found another post ( > > http://rubyforge.org/pipermail/ironruby-core/2008-January/000616.html > > ) that suggests a method of running Ruby. > > > > However, I get an error on this line > > > > IScriptEngine engine = IronRuby.GetEngine(runtime); > > > > Which shows this stack trace > > > > at System.RuntimeMethodHandle._InvokeConstructor(Object[] args, > > SignatureStruct& signature, IntPtr declaringType) > > at System.RuntimeMethodHandle.InvokeConstructor(Object[] args, > > SignatureStruct signature, RuntimeTypeHandle declaringType) > > at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags > > invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) > > at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, > > Binder binder, Object[] args, CultureInfo culture, Object[] > > activationAttributes) > > at System.Activator.CreateInstance(Type type, BindingFlags > > bindingAttr, Binder binder, Object[] args, CultureInfo culture, > > Object[] activationAttributes) > > at System.Activator.CreateInstance(Type type, Object[] args) > > at Microsoft.Scripting.Utils.ReflectionUtils.CreateInstance[T](Type > > actualType, Object[] args) in > > c:\Libraries\IronRuby\trunk\src\microsoft.scripting\Utils\ReflectionUtils.cs:line > > 127 > > > > -- > > Greg Akins > > Software Development Manager > > SSI Services > > > > http://kc.vanadium.com > > http://www.pghcodingdojo.org > > http://www.insomnia-consulting.org/monologue > > > _______________________________________________ > > Ironruby-core mailing list > > Ironruby-core at rubyforge.org > > http://rubyforge.org/mailman/listinfo/ironruby-core > > > > > > -- > Michael Letterle > [Polymath Programmer] > http://michaeldotnet.blogspot.com >-- Greg Akins Software Development Manager SSI Services http://kc.vanadium.com http://www.pghcodingdojo.org http://www.insomnia-consulting.org/monologue
Success!! I think a traumatic experience a few months ago has caused the part of my brain which deals with Assembly loading to stop working ;-) Obviously, from reading my message (below) there is a problem loading IronRuby.Libraries. When I glanced back over Michael''s email, I realized that I HAVE to reference IronRuby.Libraries.dll Michael? Are you NOT referencing those? On Jan 27, 2008 6:41 PM, Greg Akins <angrygreg at gmail.com> wrote:> Thanks to both of you. I''ll try those approaches. > > Incidentally, the line which threw my error was in > Microsoft.Scripting.Hosting.PlatformAdaptationLayer at line 90 > > #if !SILVERLIGHT > return Assembly.Load(name); <== ERROR OCCURRED ON THIS > LINE while "name" == "IronRuby.Libraries" > #else > return Assembly.Load(LookupFullName(name)); > #endif > > > > > > On Jan 27, 2008 6:34 PM, Michael Letterle <michael.letterle at gmail.com> wrote: > > I''m actually getting ready to work on an IronRuby quick start blog > > post, based on my experiences, but this is the simplest "hello world" > > using the hosting mechanism I could come up with: > > > > using System; > > using Ruby.Runtime; > > using Microsoft.Scripting.Hosting; > > namespace RubyExample > > { > > static class Program > > { > > /// <summary> > > /// The main entry point for the application. > > /// </summary> > > [STAThread] > > static void Main() > > { > > IScriptEnvironment scriptenvironment > > ScriptEnvironment.GetEnvironment(); > > IScriptEngine rubyengine = scriptenvironment.GetEngine("ruby"); > > scriptenvironment.ExecuteSourceUnit(rubyengine.CreateScriptSourceFromString("puts > > ''Hello World!\nPress Any Key To Continue..''") ); > > Console.ReadKey(); > > > > } > > } > > } > > > > be sure to add references to Microsof.Scripting.dll and IronRuby.dll > > (and IronRuby.Libraries.dll if you''re so inclined). > > > > You can also use scriptenvironment.ExecuteFile(pathtofile) if you have > > your ruby script inn a standalone file. > > > > > > On Jan 27, 2008 6:16 PM, Greg Akins <angrygreg at gmail.com> wrote: > > > OK, so I couldn''t get some of the simple examples of using RubyEngine > > > to start calling Ruby from C#... > > > > > > So I spent a bit reading through the mailing list archives (realizing > > > while doing that, that I''d asked a frequently asked question). > > > > > > Now, I hope I''m not asking another stupid question. > > > > > > I found another post ( > > > http://rubyforge.org/pipermail/ironruby-core/2008-January/000616.html > > > ) that suggests a method of running Ruby. > > > > > > However, I get an error on this line > > > > > > IScriptEngine engine = IronRuby.GetEngine(runtime); > > > > > > Which shows this stack trace > > > > > > at System.RuntimeMethodHandle._InvokeConstructor(Object[] args, > > > SignatureStruct& signature, IntPtr declaringType) > > > at System.RuntimeMethodHandle.InvokeConstructor(Object[] args, > > > SignatureStruct signature, RuntimeTypeHandle declaringType) > > > at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags > > > invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) > > > at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, > > > Binder binder, Object[] args, CultureInfo culture, Object[] > > > activationAttributes) > > > at System.Activator.CreateInstance(Type type, BindingFlags > > > bindingAttr, Binder binder, Object[] args, CultureInfo culture, > > > Object[] activationAttributes) > > > at System.Activator.CreateInstance(Type type, Object[] args) > > > at Microsoft.Scripting.Utils.ReflectionUtils.CreateInstance[T](Type > > > actualType, Object[] args) in > > > c:\Libraries\IronRuby\trunk\src\microsoft.scripting\Utils\ReflectionUtils.cs:line > > > 127 > > > > > > -- > > > Greg Akins > > > Software Development Manager > > > SSI Services > > > > > > http://kc.vanadium.com > > > http://www.pghcodingdojo.org > > > http://www.insomnia-consulting.org/monologue > > > > > _______________________________________________ > > > Ironruby-core mailing list > > > Ironruby-core at rubyforge.org > > > http://rubyforge.org/mailman/listinfo/ironruby-core > > > > > > > > > > > -- > > Michael Letterle > > [Polymath Programmer] > > http://michaeldotnet.blogspot.com > > > > > > -- > > Greg Akins > Software Development Manager > SSI Services > > http://kc.vanadium.com > http://www.pghcodingdojo.org > http://www.insomnia-consulting.org/monologue >-- Greg Akins Software Development Manager SSI Services http://kc.vanadium.com http://www.pghcodingdojo.org http://www.insomnia-consulting.org/monologue
In case anyone is interested: http://michaeldotnet.blogspot.com/2008/01/ironruby-quick-start.html As far as I know that''s correct as of rev 75. Any mistakes or omissions please let me know. (I''m still not sure about that SIGNED symbol...) On Jan 27, 2008 6:34 PM, Michael Letterle <michael.letterle at gmail.com> wrote:> I''m actually getting ready to work on an IronRuby quick start blog > post, based on my experiences, but this is the simplest "hello world" > using the hosting mechanism I could come up with: > > using System; > using Ruby.Runtime; > using Microsoft.Scripting.Hosting; > namespace RubyExample > { > static class Program > { > /// <summary> > /// The main entry point for the application. > /// </summary> > [STAThread] > static void Main() > { > IScriptEnvironment scriptenvironment > ScriptEnvironment.GetEnvironment(); > IScriptEngine rubyengine = scriptenvironment.GetEngine("ruby"); > scriptenvironment.ExecuteSourceUnit(rubyengine.CreateScriptSourceFromString("puts > ''Hello World!\nPress Any Key To Continue..''") ); > Console.ReadKey(); > > } > } > } > > be sure to add references to Microsof.Scripting.dll and IronRuby.dll > (and IronRuby.Libraries.dll if you''re so inclined). > > You can also use scriptenvironment.ExecuteFile(pathtofile) if you have > your ruby script inn a standalone file. > > > On Jan 27, 2008 6:16 PM, Greg Akins <angrygreg at gmail.com> wrote: > > OK, so I couldn''t get some of the simple examples of using RubyEngine > > to start calling Ruby from C#... > > > > So I spent a bit reading through the mailing list archives (realizing > > while doing that, that I''d asked a frequently asked question). > > > > Now, I hope I''m not asking another stupid question. > > > > I found another post ( > > http://rubyforge.org/pipermail/ironruby-core/2008-January/000616.html > > ) that suggests a method of running Ruby. > > > > However, I get an error on this line > > > > IScriptEngine engine = IronRuby.GetEngine(runtime); > > > > Which shows this stack trace > > > > at System.RuntimeMethodHandle._InvokeConstructor(Object[] args, > > SignatureStruct& signature, IntPtr declaringType) > > at System.RuntimeMethodHandle.InvokeConstructor(Object[] args, > > SignatureStruct signature, RuntimeTypeHandle declaringType) > > at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags > > invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) > > at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, > > Binder binder, Object[] args, CultureInfo culture, Object[] > > activationAttributes) > > at System.Activator.CreateInstance(Type type, BindingFlags > > bindingAttr, Binder binder, Object[] args, CultureInfo culture, > > Object[] activationAttributes) > > at System.Activator.CreateInstance(Type type, Object[] args) > > at Microsoft.Scripting.Utils.ReflectionUtils.CreateInstance[T](Type > > actualType, Object[] args) in > > c:\Libraries\IronRuby\trunk\src\microsoft.scripting\Utils\ReflectionUtils.cs:line > > 127 > > > > -- > > Greg Akins > > Software Development Manager > > SSI Services > > > > http://kc.vanadium.com > > http://www.pghcodingdojo.org > > http://www.insomnia-consulting.org/monologue > > _______________________________________________ > > Ironruby-core mailing list > > Ironruby-core at rubyforge.org > > http://rubyforge.org/mailman/listinfo/ironruby-core > > > > > > -- > Michael Letterle > [Polymath Programmer] > http://michaeldotnet.blogspot.com >-- Michael Letterle [Polymath Programmer] http://michaeldotnet.blogspot.com