# MSpec fails to load dll

**URL:** <https://www.ruby-forum.com/t/mspec-fails-to-load-dll/164820>\
**Category:** IronRuby\
**Created:** [April 6, 2009, 10:57am UTC](https://www.ruby-forum.com/t/mspec-fails-to-load-dll/164820 "2009-04-06T10:57:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![xerxesb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/da6949/32.png) [@xerxesb](https://www.ruby-forum.com/u/xerxesb)\
**Post date:** [April 6, 2009, 10:57am UTC](https://www.ruby-forum.com/t/mspec-fails-to-load-dll/164820/1 "2009-04-06T10:57:16Z")

</div>

howdy all,

i’m new to ruby and ironruby, and trying to get a simple mspec sample  
working on my machine. i’m using the 0.3 drop of IR.

When i’m running IronRuby for anything OTHER than mspec, it works  
perfectly fine. The WPF samples, the message box sample - they all  
work great.

In order to play with mspec, i’ve written a c# dll which returns a  
string (HelloWorld::HelloClass.SayHello()) and two ruby files to test  
it out.

1. The first file is a ruby script which requires the DLL and does a  
puts on the say\_hello method. This works, no problem. (eg: ir  
sayhello.rb)

2. The second file is an mspec script which requires the DLL, requires  
mspec and has once specification which calls the say\_hello method. To  
run the spec, i’ve created a batch file which calls ir.exe with the  
path to c:\ruby\bin\mspec (like the icucumber example). when i run  
this however, it fails miserably:

* * *

c:\source\ruby\hellodotnet\>imspec sayhello\_spec.rb  
ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]

1. An exception occurred during: loading  
c:/source/ruby/hellodotnet/sayhello\_spec.rb ERROR  
LoadError: 127: The specified procedure could not be found. -  
Init\_HelloWorld  
./HelloWorld.dll  
./HelloWorld.dll  
c:/ruby/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:31:in  
`require’  
c:/source/ruby/hellodotnet/sayhello\_spec.rb:2

Finished in 0.111000 seconds

1 file, 0 examples, 0 expectations, 0 failures, 1 error

* * *

Not certain, but i suspect that this might have something to do with  
the fact that it’s executing the custom\_require.rb file from c:\ruby  
and not c:\ironruby. The first line from the execution shows it’s  
using ruby 1.8.6. If this indeed the case, what should I do to fix it?  
i’ve tried setting the GEM\_PATH to various paths with no success.

Happy to provide more info if rqd.

thanks,  
Xerx.

---

<div class="post-metadata">

**Author:** ![xerxesb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/da6949/32.png) [@xerxesb](https://www.ruby-forum.com/u/xerxesb)\
**Post date:** [April 6, 2009, 6:39pm UTC](https://www.ruby-forum.com/t/mspec-fails-to-load-dll/164820/2 "2009-04-06T18:39:43Z")

</div>

MSpec is a special runner geared towards running implementation tests.  
It’s kind of nice right now because it’s more light weight than RSpec,  
so IronRuby can run it reasonably. One of the things this runner has is  
the ability to start up the runner with one implementation, then have  
that implementation call a second implementation to run the actual  
specs. So you can run mspec with MRI, and pass it an option which will  
tell it to run the specs with IronRuby. This feature appears to be  
biting you here. You are running with IronRuby, but because you aren’t  
passing that option, it is running your specs with MRI.

One option is to pass “-t c:\path\to\ir.exe”, the other is to have your  
wrapper run mspec-run or mspec-ci directly (as opposed to the mspec  
script). Give that a try and let me know if you have any more questions.

JD
