[rdnzl-devel] loading an assembly in clisp 2.42

Iver Odin Kvello iok at selvaag.no
Mon Oct 22 08:49:48 UTC 2007


>   (rdnzl:invoke "System.Reflection.Assembly" "LoadFrom"
>                 "c:\\Documents and Settings\\user\\Desktop\\Foo.dll")
> should give you the assembly.

A thing that might be of interest here is that assemblies loaded in a
LoadFrom context
don't work exactly like assemblies loaded with
Load/LoadWithPartialName and so forth;
for example de-serialization always uses Load so that won't work; and
there are other
diverse issues. See
http://blogs.msdn.com/suzcook/archive/2003/05/29/57143.aspx .

A fix that works is subscribing to the AppDomain.AssemblyResolve
event, which is
triggered when Load/LoadWithPartialName fails; you can add your own
code there to
find the assembly any way you need to. I haven't been able to actually
do this in lisp
(ACL7) via RDNZL though, as somehow I get a crash when the new assembly is
returned to the AppDomain triggering the event. But subscribing to the event in
C# code used by RDNZL works fine; I've attached an example class that
can do this.

With this class loaded (also with LoadFrom) using Load and LoadWithPartial will
work with any other paths you specify.

I think one is probably not supposed to do this either, but it does
work and people
 do use it.

(I've also attached the non-working lisp that should have handled the event in
 case anyone is interested.)

Iver Odin Kvello
iok at selvaag.no
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: RDNZLUtil.cs
URL: <https://mailman.common-lisp.net/pipermail/rdnzl-devel/attachments/20071022/bd712a41/attachment.ksh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: AddAssemblyPath.lisp
Type: application/octet-stream
Size: 1762 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/rdnzl-devel/attachments/20071022/bd712a41/attachment.obj>


More information about the rdnzl-devel mailing list