# [Ironruby-core] InternalsVisibleTo

Jimmy Schementi Jimmy.Schementi at microsoft.com
Wed Jan 20 03:46:44 EST 2010

> The call to assign the results of Parse to P always fails unless I
>
> a) Do what Ivan suggested and copy to the bin folder
> b.) Modify ir.exe.config to include the path to the actual .dll

I would suggest neither of these =P See below.

> I was reading the source code this evening and noticed that during
> the RubyContext buildup it only includes the following paths to
> resolve references:
>
> {string[4]}
>    [0]: "F:/ironruby-ironruby-178b744/Merlin/Main/Languages/Ruby/libs/"
>    [1]: "F:/ironruby-ironruby-178b744/Merlin/External.LCA_RESTRICTED/Languages/Ruby/redist-libs/ruby/site_ruby/1.8/"
>    [2]: "F:/ironruby-ironruby-178b744/Merlin/External.LCA_RESTRICTED/Languages/Ruby/redist-libs/ruby/1.8/"
>    [3]: "."
>
> I assumed this is was why if I dump my .dll into any of those paths it resolves.

Resolving DLLs should behave the same way as resolving Ruby libraries; it has to be on the load path. As you saw in the debugger, the load path is preset with the LibraryPaths value that is in the config, but it's preferred to modify the load path by appending string to the $LOAD_PATH (or$: shorthand) variable, rather than modifying the config file.

Consider the following directory structure:
/dlls/foo.dll
/bar.rb

Where foo.dll was compiled from this C# code:

public class Foo {
public static void Bar() {
System.Console.WriteLine("In Bar");
}
}

If foo.rb just looked like this:

require 'foo.dll'
Foo.bar

... and ir.exe is anywhere but the dlls directory you'd get this error:

PS C:\temp> ir .\bar.rb
from ./bar.rb:1

require 'foo.dll'
Foo.bar

Then all will work:

PS C:\temp> ir .\bar.rb
In Bar

Notice that the first line "File.dirname(__FILE__)" to make the "dlls" path relative to the current file. Then doing "require 'foo'" will look in the dlls directory.

`