From: David C. <cre...@gm...> - 2009-11-24 23:50:54
|
Hi, I have a small utility I've written, cl-reminders that runs nicely in SBCL. I'm trying to incorporate another library, unetwork, which does general network stuff like emails, web, nntp, etc. It uses CLOS for it's socket object. There is a macro with-smtp-connection that creates a simple mail and passes it over to a mail server, in the README an example usage is given as below :- (with-smtp-connection (socket "smtp.free.fr") (smtp-send-mail socket "mat...@fr..." '((:to . "fo...@co...") (:cc . "ba...@co...")) "smtp test" "Hello world!")) If I set up links to the asd file (and load unetworks required packages) and then run the above code (with altered to, from and mailserver params) I end up getting a valid email sent out. This doesn't seem to want to work for me when I build it into my package though. I've added unetwork to the depends section of my .asd file as follows:- :depends-on (:dates :debug :unetwork);:cl-typesetting) I've written a small wrapper around the the with-smtp-connection call as follows (defun unetwork-sendmail (server to subject text) (with-smtp-connection (socket server) (smtp-send-mail socket to '((:to . to) (:cc . to)) subject text))) When I call my wrapper function I get the following error:- debugger invoked on a UNDEFINED-FUNCTION in thread #<THREAD "initial thread" RUNNING {AA69769}>: The function SOCKET is undefined. Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL. restarts (invokable by number or by possibly-abbreviated name): 0: [ABORT] Exit debugger, returning to top level. ("bogus stack frame") I had a similar problem to this when I tried to include cl-typesetting. It's as if the object will only work when it's 'in-package'. Could someone point out to me what I'm doing wrong here? The version of SBCL I'm using is 1.0.25.Debian. Regards David |
From: Bhaskara M. <bha...@wi...> - 2009-11-25 00:37:29
|
On Tue, Nov 24, 2009 at 3:50 PM, David Creelman <cre...@gm...>wrote: > Hi, > I have a small utility I've written, cl-reminders that runs nicely in SBCL. > > I'm trying to incorporate another library, unetwork, which does general > network stuff like emails, web, nntp, etc. > > It uses CLOS for it's socket object. There is a macro with-smtp-connection > that creates a simple mail and passes it over to a mail server, in the > README > an example usage is given as below :- > > (with-smtp-connection (socket "smtp.free.fr") > (smtp-send-mail socket > "mat...@fr..." > '((:to . "fo...@co...") > (:cc . "ba...@co...")) > "smtp test" > "Hello world!")) > > If I set up links to the asd file (and load unetworks required packages) > and then run the above code (with altered to, from and mailserver params) > I end up getting a valid email sent out. > > This doesn't seem to want to work for me when I build it into my package > though. > > I've added unetwork to the depends section of my .asd file as follows:- > > :depends-on (:dates :debug :unetwork);:cl-typesetting) > > I've written a small wrapper around the the with-smtp-connection call as > follows > > (defun unetwork-sendmail (server to subject text) > (with-smtp-connection (socket server) > (smtp-send-mail socket > to > '((:to . to) (:cc . to)) > subject > text))) > > When I call my wrapper function I get the following error:- > > debugger invoked on a UNDEFINED-FUNCTION in thread #<THREAD "initial > thread" RUNNING {AA69769}>: > The function SOCKET is undefined. > > Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL. > > restarts (invokable by number or by possibly-abbreviated name): > 0: [ABORT] Exit debugger, returning to top level. > > ("bogus stack frame") > > I had a similar problem to this when I tried to include cl-typesetting. > It's as if the object will only work when it's 'in-package'. > > Could someone point out to me what I'm doing wrong here? > > The specific error seems to be caused by sbcl not knowing that with-smtp-connection is a macro, therefore treating (socket server) as a function call. The likely causes are either 1) the macro definition of with-smtp-connection has not been loaded 2) the symbol with-smtp-connection is in a different package, and is not present in the package where your unetwork-sendmail is defined. It's hard to diagnose further without seeing the code and system definitions. Btw, the way you used the word "package" in your message makes me suspect you might be confusing the role of a package and an asdf system. In case you aren't sure about the difference, you should look at the documentation further. - Bhaskara > The version of SBCL I'm using is 1.0.25.Debian. > > Regards > David > > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus > on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > Sbcl-help mailing list > Sbc...@li... > https://lists.sourceforge.net/lists/listinfo/sbcl-help > -- Bhaskara Marthi Research Scientist Willow Garage Inc. 650-475-2856 |
From: Bhaskara M. <bha...@wi...> - 2009-11-25 06:26:32
|
On Tue, Nov 24, 2009 at 7:53 PM, David Creelman <cre...@gm...>wrote: > On Tue, Nov 24, 2009 at 04:13:35PM -0800, Bhaskara Marthi wrote: > > On Tue, Nov 24, 2009 at 3:50 PM, David Creelman < > cre...@gm...>wrote: > > > > > Hi, > > > I have a small utility I've written, cl-reminders that runs nicely in > SBCL. > > > > <snip> > > > > > > The specific error seems to be caused by sbcl not knowing that > > with-smtp-connection is a macro, therefore treating (socket server) as a > > function call. The likely causes are either 1) the macro definition of > > with-smtp-connection has not been loaded 2) the symbol > with-smtp-connection > > is in a different package, and is not present in the package where your > > unetwork-sendmail is defined. > > unetwork exports with-smtp-connection in its package.lisp. > The package that uses unetwork has a :uses :unetwork clause in it. > I thought this would mean that :unetwork exported symbols could be used > within the package I've created. > Yes it should mean that. One way to check this is in the repl, switch to the package, let's say it's called :sendmail, in which unetwork-sendmail is defined, then do (symbol-package 'with-smtp-connection). It should say unetwork, as opposed to sendmail. If not, then the symbol has not been imported into the package. If it does return unetwork, but with-smtp-connection still gives the error, that means the macro definition has not been seen, so sbcl thinks with-smtp-connection is a function (the default assumption). That means either that the file containing the definition was not loaded, or perhaps that file didn't contain an (in-package :unetwork), so that with-smtp-connection was interpreted as belonging to the cl-user package or something. If you could post 1) the asdf file, 2) the files containing the respective defpackage's 3) the files containing the two function definitions, that would help. I don't know what the convention is, but I'm guessing attaching them as individual source files is fine. - Bhaskara > > > > > It's hard to diagnose further without seeing the code and system > > definitions. Btw, the way you used the word "package" in your message > makes > > me suspect you might be confusing the role of a package and an asdf > system. > > In case you aren't sure about the difference, you should look at the > > documentation further. > > I think I understand the difference between asdf systems and CL packages. > I threw in the explanation of .asd file just to show that the asdf > dependency > was pulling in the unetwork. > > Is it okay to throw my code into a .tar.gz and attach it to an email here? > > Cheers > David > > > - Bhaskara > > > > > > > The version of SBCL I'm using is 1.0.25.Debian. > > > > > > Regards > > > David > > > > > > > > > > ------------------------------------------------------------------------------ > > > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 > 30-Day > > > trial. Simplify your report design, integration and deployment - and > focus > > > on > > > what you do best, core application coding. Discover what's new with > > > Crystal Reports now. http://p.sf.net/sfu/bobj-july > > > _______________________________________________ > > > Sbcl-help mailing list > > > Sbc...@li... > > > https://lists.sourceforge.net/lists/listinfo/sbcl-help > > > > > > > > > > > -- > > Bhaskara Marthi > > Research Scientist > > Willow Garage Inc. > > 650-475-2856 > -- Bhaskara Marthi Research Scientist Willow Garage Inc. 650-475-2856 |