From akopa.gmane.poster at gmail.com Sat Oct 20 05:05:05 2007 From: akopa.gmane.poster at gmail.com (Matthew Swank) Date: Sat, 20 Oct 2007 05:05:05 +0000 (UTC) Subject: [rdnzl-devel] loading an assembly in clisp 2.42 Message-ID: I have a library written in C# -- Foo.dll. I am able to load rdnzl in clisp, and run simple examples that involve importing registered libs: "Hello World!", etc. No matter where I put Foo.dll, (load-assembly "Foo") results in: WARNING: Returning NULL object from .NET call NIL When I specify a full path: (load-assembly "c:\\Documents and Settings\\user\\Desktop\\Foo.dll") I get: *** - .NET error (System.IO.FileLoadException): The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047) I'm not sure what to do at this point. I am using rdnzl-0.11.0 with the included dll and Foo is compiled in Visual Studio 2005. I also get the same result using a patched rdnzl-0.5.0 compiled in Visual Studio 2008. Any Ideas? Thanks, Matt From edi at agharta.de Sat Oct 20 14:54:55 2007 From: edi at agharta.de (Edi Weitz) Date: Sat, 20 Oct 2007 16:54:55 +0200 Subject: [rdnzl-devel] loading an assembly in clisp 2.42 In-Reply-To: (Matthew Swank's message of "Sat, 20 Oct 2007 05:05:05 +0000 (UTC)") References: Message-ID: On Sat, 20 Oct 2007 05:05:05 +0000 (UTC), Matthew Swank wrote: > I have a library written in C# -- Foo.dll. I am able to load rdnzl > in clisp, and run simple examples that involve importing registered > libs: "Hello World!", etc. No matter where I put Foo.dll, > (load-assembly "Foo") results in: > > WARNING: Returning NULL object from .NET call > NIL You should succeed if you put Foo.dll in the folder where your CLISP executable is (/before/ you start CLISP). > When I specify a full path: > (load-assembly "c:\\Documents and Settings\\user\\Desktop\\Foo.dll") > > I get: > > *** - .NET error (System.IO.FileLoadException): The given assembly name or > codebase was invalid. (Exception from HRESULT: 0x80131047) LOAD-ASSEMBLY uses System.Reflection.Assembly::LoadWithPartialName internally - that one doesn't work with full pathnames. > I'm not sure what to do at this point. (rdnzl:invoke "System.Reflection.Assembly" "LoadFrom" "c:\\Documents and Settings\\user\\Desktop\\Foo.dll") should give you the assembly. HTH, Edi. PS: See the notes in the documentation about CLISP. You should try one of the Lisps that are fully supported instead. From akopa.gmane.poster at gmail.com Sat Oct 20 23:54:48 2007 From: akopa.gmane.poster at gmail.com (Matthew D Swank) Date: Sat, 20 Oct 2007 18:54:48 -0500 Subject: [rdnzl-devel] Re: loading an assembly in clisp 2.42 References: Message-ID: On Sat, 20 Oct 2007 16:54:55 +0200, Edi Weitz wrote: > On Sat, 20 Oct 2007 05:05:05 +0000 (UTC), Matthew Swank wrote: > >> I have a library written in C# -- Foo.dll. I am able to load rdnzl >> in clisp, and run simple examples that involve importing registered >> libs: "Hello World!", etc. No matter where I put Foo.dll, >> (load-assembly "Foo") results in: >> >> WARNING: Returning NULL object from .NET call >> NIL > > You should succeed if you put Foo.dll in the folder where your CLISP > executable is (/before/ you start CLISP). > >> When I specify a full path: >> (load-assembly "c:\\Documents and Settings\\user\\Desktop\\Foo.dll") >> >> I get: >> >> *** - .NET error (System.IO.FileLoadException): The given assembly name or >> codebase was invalid. (Exception from HRESULT: 0x80131047) > > LOAD-ASSEMBLY uses System.Reflection.Assembly::LoadWithPartialName > internally - that one doesn't work with full pathnames. > >> I'm not sure what to do at this point. > > (rdnzl:invoke "System.Reflection.Assembly" "LoadFrom" > "c:\\Documents and Settings\\user\\Desktop\\Foo.dll") > > should give you the assembly. > > HTH, > Edi. > Thanks, all those suggestions worked. > PS: See the notes in the documentation about CLISP. You should try > one of the Lisps that are fully supported instead. Well, I am constrained to use clisp or sbcl. I plan on getting around the callback issue by running the gui in a separtate .NET thread and running and event loop on the lisp side to listen to .NET events over a set of synchronized channels. Btw, it needs a little cleanup, but I've updated the VS 2005 version of the cpp project to conform to the 0.6.0 protocol. Would you like a copy of it when I have it ready? Matt -- "You do not really understand something unless you can explain it to your grandmother." ? Albert Einstein. From edi at agharta.de Sun Oct 21 10:16:41 2007 From: edi at agharta.de (Edi Weitz) Date: Sun, 21 Oct 2007 12:16:41 +0200 Subject: [rdnzl-devel] Re: loading an assembly in clisp 2.42 In-Reply-To: (Matthew D. Swank's message of "Sat, 20 Oct 2007 18:54:48 -0500") References: Message-ID: On Sat, 20 Oct 2007 18:54:48 -0500, Matthew D Swank wrote: > Btw, it needs a little cleanup, but I've updated the VS 2005 version > of the cpp project to conform to the 0.6.0 protocol. Would you like > a copy of it when I have it ready? Yes, please. Thanks. From iok at selvaag.no Mon Oct 22 08:49:48 2007 From: iok at selvaag.no (Iver Odin Kvello) Date: Mon, 22 Oct 2007 10:49:48 +0200 Subject: [rdnzl-devel] loading an assembly in clisp 2.42 In-Reply-To: References: Message-ID: > (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: -------------- next part -------------- A non-text attachment was scrubbed... Name: AddAssemblyPath.lisp Type: application/octet-stream Size: 1762 bytes Desc: not available URL: From akopa.gmane.poster at gmail.com Mon Oct 22 13:03:03 2007 From: akopa.gmane.poster at gmail.com (Matthew Swank) Date: Mon, 22 Oct 2007 13:03:03 +0000 (UTC) Subject: [rdnzl-devel] Head scratcher accessing a property using clisp 2.42 Message-ID: Evaluating [%KeyChar args] when args is a KeyPressEventArgs produces the following: *** - FUNCALL: undefined function #:INTERNAL-NAME5570 The following restarts are available: USE-VALUE :R1 You may input a value to be used instead of (FDEFINITION '#:INTERNAL-NAME5570). RETRY :R2 Retry STORE-VALUE :R3 You may input a new value for (FDEFINITION '#:INTERNAL-NAME5570). SKIP :R4 skip (RUN-APROPOS-FORM) ABORT :R6 ABORT Matt From edi at agharta.de Mon Oct 22 13:57:02 2007 From: edi at agharta.de (Edi Weitz) Date: Mon, 22 Oct 2007 15:57:02 +0200 Subject: [rdnzl-devel] Head scratcher accessing a property using clisp 2.42 In-Reply-To: (Matthew Swank's message of "Mon, 22 Oct 2007 13:03:03 +0000 (UTC)") References: Message-ID: On Mon, 22 Oct 2007 13:03:03 +0000 (UTC), Matthew Swank wrote: > Evaluating [%KeyChar args] when args is a KeyPressEventArgs produces > the following: > *** - FUNCALL: undefined function #:INTERNAL-NAME5570 > The following restarts are available: > USE-VALUE :R1 You may input a value to be used instead of > (FDEFINITION '#:INTERNAL-NAME5570). > RETRY :R2 Retry > STORE-VALUE :R3 You may input a new value for > (FDEFINITION '#:INTERNAL-NAME5570). > SKIP :R4 skip (RUN-APROPOS-FORM) > ABORT :R6 ABORT Which Lisp? Does it work with other Lisps? What exactly did you do? Backtrace?