[rdnzl-devel] Make calls in the reverse direction (.NET -> CL)

Raymond Wiker rwiker at gmail.com
Sat Apr 24 17:03:32 UTC 2010


On Apr 24, 2010, at 16:45, Joerthan Panest wrote:

> I've been trying to figure out a way to make this sort of approach work.
> 
> On Thu, Apr 22, 2010 at 3:18 PM, Raymond Wiker <rwiker at gmail.com> wrote:
> Alternatively, it might be possible to (ab)use the delegate support in RDNZL to get what you need - simply define the delegate signatures you require in an interface class on the C# side, then use RDNZL to create an interface object and attach lisp closures (I do something like this to implement LISP callbacks for a somewhat misdesigned .NET library).
> 
> Ok, I create a shared .NET DLL that defines the interface and all needed classes. I can deliver a "C DLL" with LispWorks that is able to instantiate the types and interface as well as register callbacks with these types that it has instantiated.
> 
> The fundamental issue that I cannot work around here is that there is no clear way to pass along the previously instantiated from the .NET application through to any functions exposed by the Lisp DLL.


If I understand you correctly, it should(?) be as simple as defining a delegate on a class, and a setter for the delegate. You can then add a lisp delegate to an object known by (or created from) Lisp. The arguments to the delegate could then include arbitrary .NET objects.

This is not a general solution in the way that RDNZL works (in the opposite direction), but then again... the callback you define could have the semantics of #'apply, with the first argument being a string that names a function, and the second argument being a list of parameters (not needed if C# supports functions with a variable number of arguments).



More information about the rdnzl-devel mailing list