On Tue, Nov 24, 2009 at 3:50 PM, David Creelman <creelman.david@gmail.com> 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
                       "matthieu.villeneuve@free.fr"
                       '((:to . "foo@common-lisp.net")
                         (:cc . "bar@common-lisp.net"))
                       "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
Sbcl-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sbcl-help



--
Bhaskara Marthi
Research Scientist
Willow Garage Inc.
650-475-2856