From rwiker at gmail.com Mon Nov 9 08:36:41 2009 From: rwiker at gmail.com (Raymond Wiker) Date: Mon, 9 Nov 2009 09:36:41 +0100 Subject: [rdnzl-devel] LoadWithPartialName vs Load Message-ID: <9cd322050911090036j7568a250o398535dac57bb45c@mail.gmail.com> 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 From edi at agharta.de Mon Nov 9 21:16:57 2009 From: edi at agharta.de (Edi Weitz) Date: Mon, 9 Nov 2009 22:16:57 +0100 Subject: [rdnzl-devel] LoadWithPartialName vs Load In-Reply-To: <9cd322050911090036j7568a250o398535dac57bb45c@mail.gmail.com> References: <9cd322050911090036j7568a250o398535dac57bb45c@mail.gmail.com> Message-ID: Hi Raymond, I have to admit that I rarely, if ever, used RDNZL myself. I started writing it for fun and only finished it because I gave a talk about it. At that time I was ambitious enough to bring it into a usable state, but as I didn't have any serious projects relying on it, I didn't keep track with .NET development and I'm sure it's out of tune now. If you have changes to make RDNZL better, I'm happy to accept patches, but I won't be able to test or evaluate them due to lack of time. I'll simply pack them into a new release if they follow the usual patch guidelines: http://weitz.de/patches.html Thanks, Edi. On Mon, Nov 9, 2009 at 9:36 AM, Raymond Wiker wrote: > 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 > > _______________________________________________ > rdnzl-devel mailing list > rdnzl-devel at common-lisp.net > http://common-lisp.net/cgi-bin/mailman/listinfo/rdnzl-devel > > From rwiker at gmail.com Tue Nov 10 10:55:28 2009 From: rwiker at gmail.com (Raymond Wiker) Date: Tue, 10 Nov 2009 11:55:28 +0100 Subject: [rdnzl-devel] LoadWithPartialName vs Load In-Reply-To: References: <9cd322050911090036j7568a250o398535dac57bb45c@mail.gmail.com> Message-ID: I've had a little startup trouble with RDNZL, but this is mainly due to my lack of familiarity with .NET. The use of Load instead of LoadWithPartialName will most likely not be noticed by most people, but will provide (IMO) more helpful behaviour in case of errors. It can also be extended, at some later point, to use fully-qualified assembly names. The enclosed patch includes the trivial change to load-assembly, as well as a new macro called do-rdnzl-container. do-rdnzl-container does for general enumerable collections what do-rdnzl-arrays does for arrays. Thank you for making rdnzl available! -------------- next part -------------- A non-text attachment was scrubbed... Name: rdznl.patch Type: application/octet-stream Size: 3934 bytes Desc: not available URL: -------------- next part -------------- On Nov 9, 2009, at 22:16 , Edi Weitz wrote: > Hi Raymond, > > I have to admit that I rarely, if ever, used RDNZL myself. I started > writing it for fun and only finished it because I gave a talk about > it. At that time I was ambitious enough to bring it into a usable > state, but as I didn't have any serious projects relying on it, I > didn't keep track with .NET development and I'm sure it's out of tune > now. > > If you have changes to make RDNZL better, I'm happy to accept patches, > but I won't be able to test or evaluate them due to lack of time. > I'll simply pack them into a new release if they follow the usual > patch guidelines: > > http://weitz.de/patches.html > > Thanks, > Edi. > > > On Mon, Nov 9, 2009 at 9:36 AM, Raymond Wiker > wrote: >> 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 >> >> _______________________________________________ >> rdnzl-devel mailing list >> rdnzl-devel at common-lisp.net >> http://common-lisp.net/cgi-bin/mailman/listinfo/rdnzl-devel >> >> > > _______________________________________________ > rdnzl-devel mailing list > rdnzl-devel at common-lisp.net > http://common-lisp.net/cgi-bin/mailman/listinfo/rdnzl-devel From edi at agharta.de Thu Nov 12 20:57:10 2009 From: edi at agharta.de (Edi Weitz) Date: Thu, 12 Nov 2009 21:57:10 +0100 Subject: [rdnzl-devel] New release 0.13.0 (Was: LoadWithPartialName vs Load) Message-ID: Thanks Raymond, I've just made a new release. I made a few cosmetic changes, so please check if I didn't break anything. On Tue, Nov 10, 2009 at 11:55 AM, Raymond Wiker wrote: > I've had a little startup trouble with RDNZL, but ?this is mainly due to my > lack of familiarity with .NET. The use of Load instead of > LoadWithPartialName will most likely not be noticed by most people, but will > provide (IMO) more helpful behaviour in case of errors. It can also be > extended, at some later point, to use fully-qualified assembly names. > > The enclosed patch includes the trivial change to load-assembly, as well as > a new macro called do-rdnzl-container. do-rdnzl-container does for general > enumerable collections what do-rdnzl-arrays does for arrays. > > Thank you for making rdnzl available! > > > > > On Nov 9, 2009, at 22:16 , Edi Weitz wrote: > >> Hi Raymond, >> >> I have to admit that I rarely, if ever, used RDNZL myself. ?I started >> writing it for fun and only finished it because I gave a talk about >> it. ?At that time I was ambitious enough to bring it into a usable >> state, but as I didn't have any serious projects relying on it, I >> didn't keep track with .NET development and I'm sure it's out of tune >> now. >> >> If you have changes to make RDNZL better, I'm happy to accept patches, >> but I won't be able to test or evaluate them due to lack of time. >> I'll simply pack them into a new release if they follow the usual >> patch guidelines: >> >> ?http://weitz.de/patches.html >> >> Thanks, >> Edi. >> >> >> On Mon, Nov 9, 2009 at 9:36 AM, Raymond Wiker wrote: >>> >>> 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 >>> >>> _______________________________________________ >>> rdnzl-devel mailing list >>> rdnzl-devel at common-lisp.net >>> http://common-lisp.net/cgi-bin/mailman/listinfo/rdnzl-devel >>> >>> >> >> _______________________________________________ >> rdnzl-devel mailing list >> rdnzl-devel at common-lisp.net >> http://common-lisp.net/cgi-bin/mailman/listinfo/rdnzl-devel > > >