External (non-GAC) DLLs

May 12, 2009 at 1:36 PM

I have been trying to use IronScheme for a little project and I have hit a roadblock: how do I use the clr library to reference external DLLs that are not in GAC? I have no problem importing .NET assemblies that are already in the GAC (i.e. System.Collections, etc.), but when I run:

(clr-reference SomeAssembly)


(clr-reference SomeAssembliesDll.dll)

followed, of course, by

(clr-using SomeAssembly)

I only get type not found errors when I attempt to instantiate one of the objects in that DLL. Finally, I have tried the /path and /run switches and the problem remains the same.

Is there any way to do this?

May 12, 2009 at 1:40 PM

I will investigate the issue.

Try using the fully qualified name as shown in Reflector.NET. eg:

(clr-reference "IronScheme.Closures, Version=, Culture=neutral, PublicKeyToken=null")

Note: the argument is a string. 

Try that and let me know if it works  :)



May 12, 2009 at 2:20 PM

I just tried it (using the qualified name in Reflector.NET) and I still get the error which is, for posterity,

&who:               ClrNewInternalGenerator.Generate
&clr-type:           System.NullReferenceException
&message:        Object reference not set to an instance of an object

I can post code, if that would help.

Thanks for your help and the fine work on IronScheme!

May 12, 2009 at 2:49 PM

Hi again

I have it working with a little library.

There are 2 ways:

1. (clr-reference "Twain.NET, Version=, Culture=neutral, PublicKeyToken=null")

2. (clr-reference Twain.NET) ; no string, no extension, no quote

I just tested and confirmed both these cases work.  What does not work, is when the assembly is not found, and it is suppose to signal an error!

Just some other observations.

1. Is the assembly in the same path as IronScheme.dll?

2. Are there other non GAC dependent assemblies not in that directory?

To get point 2 working (assemblies from outside), you will need to modify the app.config to specify additional 'binary load paths'. This is a standard .NET thing, and not IronScheme specific.



May 14, 2009 at 12:41 PM

I found the hangup. The string form did work, but the docs of the API I was using gave the wrong name for one of the classes. Do you have any sort of documentation wiki? I was thinking of writing up some of my "discoveries" as I go along, as I have found myself flipping through the source a few times to find out how things are meant to work (i.e. order of arguments, that sort of thing).

May 15, 2009 at 3:04 PM

Cool  :)

About the wiki.

Unfortunately nothing yet. I am however working on something similar (its part of the web demo), but have yet to decide how to host it.

It is one of the things I want to finish before going 'RC', so just hang in there!