From: Geoff Hulette
Subject: help a newbie?
Date: 
Message-ID: <330CAD95.7C909B64@emerald.tufts.edu>
ok, i just barely started learning lisp, and have only a very basic idea
of what i am doing.  i know this is a stupid project, but i want to
figure it out.  i want to write a compiled hello world program in lisp. 
this is possible, using compile-file, right?  this is what i tried
writing:

(defun hello () (format t "Hello World!"))

i saved it out as test.lsp.  great, this works in the interpreter when i
load it.  i then tried to compile-file on this it gives me a .o file,
which i linked.  needless to say, it wouldn't work.  i am using gcl for
lisp and gcc to link, both running under my linux system.  if anyone has
any ideas, i would love to hear from you.  any other tips for a beginner
would also be appreciated.  thanks.

geoff
-- 
Geoff Hulette
004 Hodgdon Hall
Tufts University
Medford, MA 02155
········@emerald.tufts.edu

From: Marco Antoniotti
Subject: Re: help a newbie?
Date: 
Message-ID: <s0867zm5bwc.fsf@crawdad.ICSI.Berkeley.EDU>
Geoff Hulette <········@emerald.tufts.edu> writes:

> 
> ok, i just barely started learning lisp, and have only a very basic idea
> of what i am doing.  i know this is a stupid project, but i want to
> figure it out.  i want to write a compiled hello world program in lisp. 
> this is possible, using compile-file, right?  this is what i tried
> writing:
> 
> (defun hello () (format t "Hello World!"))
> 
> i saved it out as test.lsp.  great, this works in the interpreter when i
> load it.  i then tried to compile-file on this it gives me a .o file,
> which i linked.  needless to say, it wouldn't work.  i am using gcl for
> lisp and gcc to link, both running under my linux system.  if anyone has
> any ideas, i would love to hear from you.  any other tips for a beginner
> would also be appreciated.  thanks.
> 

Back to basics.  You are using gcl to compile to a .o file (via gcc,
but this is irrelevant)  You have not done any "linking" up to now.  A
.o file is not "runnable".

The actual linking is done by the "loader" of GCL. I.e. the function
'load'.

> (load "hello.o")  ; If you do not do this you are not "linking" anything.

Now you have the function 'hello' in the GCL symbol table.  You
need to call it.

> (hello)
Hello World!

Got it? :)

Cheers

-- 
Marco Antoniotti - Resistente Umano
===============================================================================
International Computer Science Institute	| ·······@icsi.berkeley.edu
1947 Center STR, Suite 600			| tel. +1 (510) 643 9153
Berkeley, CA, 94704-1198, USA			|      +1 (510) 642 4274 x149
===============================================================================
	...it is simplicity that is difficult to make.
	...e` la semplicita` che e` difficile a farsi.
				Bertholdt Brecht
From: Martin Cracauer
Subject: Re: help a newbie?
Date: 
Message-ID: <1997Feb21.114440.7960@wavehh.hanse.de>
Geoff Hulette <········@emerald.tufts.edu> writes:

>ok, i just barely started learning lisp, and have only a very basic idea
>of what i am doing.  i know this is a stupid project, but i want to
>figure it out.  i want to write a compiled hello world program in lisp. 
>this is possible, using compile-file, right?  this is what i tried
>writing:

>(defun hello () (format t "Hello World!"))

>i saved it out as test.lsp.  great, this works in the interpreter when i
>load it.  i then tried to compile-file on this it gives me a .o file,
>which i linked.  needless to say, it wouldn't work.  i am using gcl for

It would have been useful to include a transcript of your
session. What does "wouldn't work" mean.

I assume it simply does nothing. Then the problem is that you expect
(compile-file ...) to load the file. It does not. After you compiled
the file, you still have to (load ...) it. The Lisp system
automatically selects a compiled version of the file if it
exists. Most Lisp systems also support a :load option for
compile-file. 

>lisp and gcc to link, both running under my linux system.  if anyone has
>any ideas, i would love to hear from you.  any other tips for a beginner
>would also be appreciated.  thanks.

>geoff
>-- 
>Geoff Hulette
>004 Hodgdon Hall
>Tufts University
>Medford, MA 02155
>········@emerald.tufts.edu
-- 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
···············@wavehh.hanse.de http://cracauer.cons.org  Fax.: +4940 5228536
"As far as I'm concerned,  if something is so complicated that you can't ex-
 plain it in 10 seconds, then it's probably not worth knowing anyway"- Calvin