Page 1 of 1

How to create package / system files?

Posted: Sun Jul 15, 2012 1:37 pm
by Newbie
Hello,

I am fairly new to Lisp. Or better speaking, I had a short love affair with Lisp at a time I can hardly remember. After a couple of years of unhappy marriages with other languages, I am looking to file finally for divorce and turning back to see what my old love is doing nowadays.

I succesfully installed SBCL on a Windows machine (no flaming please!) and got Emacs and slime running. Just for trying out in could load cl-mysql and ltk packages with quicklisp and got some thing running already.

I to organize my code in modules, so the (defpackage ..) comes handy, but I want to organize my code in several files on the disk as well.

I produced some code

hw.lisp:

Code: Select all

(defpackage :helloworld
  (:use :common-lisp)
  (:export :helloworld ))
...
and made a hw.asd file

Code: Select all

(defsystem :helloworld
  :name "Hello World"
  :version "0.1"
  :components ((:file "hw")))
However

Code: Select all

(require 'helloworld)
leads only to

Code: Select all

Don't know how to REQUIRE HELLOWORLD.
[Condition of type SB-INT:EXTENSION-FAILURE]
I put the files into my C:\home\SBCL\site-systems directory, but this was only a guess. Maybe they weren't read in for that reason.

Re: How to create package / system files?

Posted: Mon Jul 16, 2012 1:17 pm
by nuntius
I forget where ASDF looks for things on Windows these days. Here's the manual.

You may need an explicit "(require :asdf)" to get ASDF loaded first. On SBCL, ASDF auto-hooks into REQUIRE; but "(asdf:load-system :helloworld)" is the fundamental call.

Re: How to create package / system files?

Posted: Mon Jul 16, 2012 8:12 pm
by edgar-rft
The LISPBUILDER-SDL Windows SBCL installation tutorial contains a description how to setup ASDF with SBCL on Windows.

Re: How to create package / system files?

Posted: Tue Jul 17, 2012 12:20 pm
by Newbie
Thanks for the replies.

I used quicklisp so far for loading the ltk and my-sql packages, so I investigated whether quicklisp was some kind of help. After googling for quicklisp functionality, I found that you can to edit the quicklisp/local-projects/system-index.txt by adding

Code: Select all

C:/home/SBCL/site-systems/hw.asd
and after loading the package definition by

Code: Select all

(ql:quickload 'hw)
then

Code: Select all

(require 'hw)
loads the package.

I hope that helps other with similiar issues in future.

Re: How to create package / system files?

Posted: Tue Jul 31, 2012 5:19 am
by virex
IIRC, you can use the variable

Code: Select all

asdf::*default-source-registry*
to see in what directory ASDF starts looking. You can also specify this yourself, using the interface edgar-rft linked to, but that's quite a bit of a clusterfoo.