# Embedding Ruby in c#

**URL:** <https://www.ruby-forum.com/t/embedding-ruby-in-c/91130>\
**Category:** Ruby\
**Created:** [April 4, 2007, 11:35pm UTC](https://www.ruby-forum.com/t/embedding-ruby-in-c/91130 "2007-04-04T23:35:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![leslieviljoen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/3d9bf3/32.png) [@leslieviljoen](https://www.ruby-forum.com/u/leslieviljoen)\
**Post date:** [April 4, 2007, 11:35pm UTC](https://www.ruby-forum.com/t/embedding-ruby-in-c/91130/1 "2007-04-04T23:35:16Z")

</div>

Hi All

I have installed RubyDotNet from here:  
[http://rubydotnet.sourceforge.net/](http://rubydotnet.sourceforge.net/) because I want to embed a Ruby  
interpreter in C#. In my C# project I added a reference to  
RubyInterpreter.dll and then tried:

RubyDotNet.RubyInterpreter.instance.eval(“5”); … but I got the error:  
"unable to load DLL ‘c:/ruby180/bin/msvcrt-ruby18.dll’.

Since my Ruby is under c:/ruby, and RubyDotNet’s setup.rb had copied  
files there, I made a duplicate ruby180 directory and copied the same  
files there. I then also copied the msvcrt-ruby18.dll file from my  
c:/ruby/bin to my ruby180/bin directory. This produced an  
‘AccessViolationException’, which is some kind of memory corruption.

Perhaps this RubyDotNet is old and based on Ruby 1.8.0 and not my Ruby  
1.8.5 one-click installer. Should I bother trying to install an old  
1.8.0 Ruby or is this not going to work? Is there some other (better)  
way to embed a ruby interpreter in a C# app? I want to embed a  
scripting engine so that I can change a rules engine at run-time.

Leslie
