From: Ram Bhamidipaty
Subject: newbie question about load, eval-when and packages (sbcl)
Date: 
Message-ID: <b96d579c-2baf-4ba5-b28d-fe24f8a9324d@w8g2000prd.googlegroups.com>
I have a small package:

lib1.lisp:
------------------
(defpackage #:lib1
    (:use #:common-lisp)
  (:export #:hello))

(in-package #:lib1)

(defun hello ()
  "hello")
------------------

I am trying to use that package in another
lisp program - and I want to dump an executable.

user1.lisp:
------------------
(eval-when (:compile-toplevel :load-toplevel)
  (load "lib1" :verbose t :print t))

(use-package "LIB1")

(defun doit ()
  (hello))

(sb-ext:save-lisp-and-die "user1" :toplevel 'doit :executable t)
------------------

I am using sbcl. When do "sbcl --load user1.lisp" I get
this error:

sbcl --load user1.lisp
This is SBCL 1.0.16, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.

debugger invoked on a SIMPLE-ERROR:
  Error during processing of --eval option (LOAD #P"user1.lisp"):

  The name "LIB1" does not designate any package.

Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [CONTINUE] Ignore and continue with next --eval option.
  1: [ABORT   ] Skip rest of --eval options.
  2:            Skip to toplevel READ/EVAL/PRINT loop.
  3: [QUIT    ] Quit SBCL (calling #'QUIT, killing the process).

((LAMBDA (SB-IMPL::E)) #<SB-KERNEL:SIMPLE-PACKAGE-ERROR {A674A81}>)
0] 3


I don't understand this message.


To further confuse me - in slime I can do this:

(load "lib1" :verbose t :print t)
(use-package "LIB1")

and that works great.

Please help!
-Ram

From: Rainer Joswig
Subject: Re: newbie question about load, eval-when and packages (sbcl)
Date: 
Message-ID: <joswig-8C0E9C.17135330052008@news-europe.giganews.com>
In article 
<····································@w8g2000prd.googlegroups.com>,
 Ram Bhamidipaty <·······@gmail.com> wrote:

> I have a small package:
> 
> lib1.lisp:
> ------------------
> (defpackage #:lib1
>     (:use #:common-lisp)
>   (:export #:hello))
> 
> (in-package #:lib1)
> 
> (defun hello ()
>   "hello")
> ------------------
> 
> I am trying to use that package in another
> lisp program - and I want to dump an executable.
> 
> user1.lisp:
> ------------------
> (eval-when (:compile-toplevel :load-toplevel)
>   (load "lib1" :verbose t :print t))
> 
> (use-package "LIB1")
> 
> (defun doit ()
>   (hello))
> 
> (sb-ext:save-lisp-and-die "user1" :toplevel 'doit :executable t)
> ------------------
> 
> I am using sbcl. When do "sbcl --load user1.lisp" I get
> this error:
> 
> sbcl --load user1.lisp
> This is SBCL 1.0.16, an implementation of ANSI Common Lisp.
> More information about SBCL is available at <http://www.sbcl.org/>.
> 
> SBCL is free software, provided as is, with absolutely no warranty.
> It is mostly in the public domain; some portions are provided under
> BSD-style licenses.  See the CREDITS and COPYING files in the
> distribution for more information.
> 
> debugger invoked on a SIMPLE-ERROR:
>   Error during processing of --eval option (LOAD #P"user1.lisp"):

Just a guess: it did not load lib1.lisp . Check your EVAL-WHEN statement.
Add :execute for example.
> 
>   The name "LIB1" does not designate any package.
> 
> Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.
> 
> restarts (invokable by number or by possibly-abbreviated name):
>   0: [CONTINUE] Ignore and continue with next --eval option.
>   1: [ABORT   ] Skip rest of --eval options.
>   2:            Skip to toplevel READ/EVAL/PRINT loop.
>   3: [QUIT    ] Quit SBCL (calling #'QUIT, killing the process).
> 
> ((LAMBDA (SB-IMPL::E)) #<SB-KERNEL:SIMPLE-PACKAGE-ERROR {A674A81}>)
> 0] 3
> 
> 
> I don't understand this message.
> 
> 
> To further confuse me - in slime I can do this:
> 
> (load "lib1" :verbose t :print t)
> (use-package "LIB1")
> 
> and that works great.
> 
> Please help!
> -Ram

-- 
http://lispm.dyndns.org/
From: Ram Bhamidipaty
Subject: Re: newbie question about load, eval-when and packages (sbcl)
Date: 
Message-ID: <629729f9-52f3-4793-80a9-a166c7e0928e@b5g2000pri.googlegroups.com>
Perfect! Thank you! It works!

-Ram