[rdnzl-devel] LoadWithPartialName vs Load

Raymond Wiker rwiker at gmail.com
Mon Nov 9 08:36:41 UTC 2009


Hi,
I'm trying to use rdnzl to interface with certain .NET libraries.
These libraries have a callback mechanism that requires me to subclass
a C# class (or implement a C# interface) with two specific methods. I
haven't seen any mention that RDNZL can be used to subclass C# classes
(which I guess would be non-trivial to do), so I'm guessing that I
need to write a C# wrapper class for interfacing with Lisp.

I'm having certain problems with this, probably caused by some .NET
details that I haven't (yet) understood. As part of unravelling this,
I've discovered that import-assembly calls load-assembly and that a
failure in load-assembly will cause a null assembly to be returned,
from which import-assembly will import exactly zero items. In other
words, any errors from load-assembly will not be signalled until
later.

The MS documentation states that LoadWithPartialName (as used by
load-assembly) is an obsolete call, and that that
System.Reflection.Assembly.Load() should be used instead. Load() can
even be used with partial names, like this:

(defun load-assembly-2 (name)
  (let ((fullname (new "System.Reflection.AssemblyName")))
    (setf [%Name fullname] name)
    [System.Reflection.Assembly.Load fullname]))

I've just tried this, and load-assembly-2 gives an exception which is
transferred perfectly through RDNZL in cases where load-assembly
returns null.

Regards,
Raymond Wiker




More information about the rdnzl-devel mailing list