Can someone point me to some documentation on how to compile Lisp to C
(machine) using GCL; I have looked everywhere and can not find
anything on how to do this. The whole reason I installed gcl in the
first place was to be able to compile Lisp to C, I had no problems
compiling gcl, it runs great--but now I want to compile Lisp programs
to C and can not find any documentation anywhere.
-
ed
Edward Wilson wrote:
> Can someone point me to some documentation on how to compile Lisp to C
> (machine) using GCL; I have looked everywhere and can not find
> anything on how to do this.
The command-line switch you want to use is ``-c-file''.
Try something like this:
$ gcl -c-file -compile mandelbrot.lisp
Afterwards, you will find a file mandelbrot.c in your current
directory.
The switch is mentioned in the man page. For me, this works:
$ man 1 gcl
Cheers,
Christian
--
Christian Pietsch
http://www.interling.de
> $ gcl -c-file -compile mandelbrot.lisp
Ok, this worked, thank you. Do I have to link against a particular
lib, I was not able to link - see output below:
[····@webwarrior lisp]$ gcc -o callme callme.c testme.o -I.
testme.o: In function `L1':
testme.o(.text+0x4): undefined reference to `vs_limit'
testme.o(.text+0xa): undefined reference to `vs_base'
testme.o(.text+0x10): undefined reference to `vs_top'
testme.o(.text+0x1a): undefined reference to `vs_overflow'
testme.o(.text+0x20): undefined reference to `Ct_body'
testme.o(.text+0x2e): undefined reference to `vs_base'
testme.o(.text+0x34): undefined reference to `vs_top'
testme.o: In function `init_code':
testme.o(.text+0x49): undefined reference to `do_init'
testme.o: In function `L1':
testme.o(.text+0x3c): undefined reference to `Lformat'
collect2: ld returned 1 exit status
[····@webwarrior lisp]$
> The switch is mentioned in the man page. For me, this works:
> $ man 1 gcl
This didn't work for me, perhaps ``make install'' did not install the
man pages.
-
ed
Greetings!
Compiled objects must be linked from within gcl itself. Try:
gcl
>(compile-file "foo.lisp")
>(load "foo.o")
>....run your compiled functions...
or if your file has top level commands:
gcl -compile foo.lisp
gcl -batch foo.o
Take care,
······@yahoo.com (Edward Wilson) writes:
> > $ gcl -c-file -compile mandelbrot.lisp
>
> Ok, this worked, thank you. Do I have to link against a particular
> lib, I was not able to link - see output below:
>
> [····@webwarrior lisp]$ gcc -o callme callme.c testme.o -I.
> testme.o: In function `L1':
> testme.o(.text+0x4): undefined reference to `vs_limit'
> testme.o(.text+0xa): undefined reference to `vs_base'
> testme.o(.text+0x10): undefined reference to `vs_top'
> testme.o(.text+0x1a): undefined reference to `vs_overflow'
> testme.o(.text+0x20): undefined reference to `Ct_body'
> testme.o(.text+0x2e): undefined reference to `vs_base'
> testme.o(.text+0x34): undefined reference to `vs_top'
> testme.o: In function `init_code':
> testme.o(.text+0x49): undefined reference to `do_init'
> testme.o: In function `L1':
> testme.o(.text+0x3c): undefined reference to `Lformat'
> collect2: ld returned 1 exit status
> [····@webwarrior lisp]$
>
>
> > The switch is mentioned in the man page. For me, this works:
> > $ man 1 gcl
> This didn't work for me, perhaps ``make install'' did not install the
> man pages.
>
> -
> ed
--
Camm Maguire ····@enhanced.com
==========================================================================
"The earth is but one country, and mankind its citizens." -- Baha'u'llah
(message (Hello 'Edward)
(you :wrote :on '(31 Jul 2004 12:27:11 -0700))
(
EW> Can someone point me to some documentation on how to compile Lisp to
EW> C (machine) using GCL; I have looked everywhere and can not find
EW> anything on how to do this. The whole reason I installed gcl in
EW> the first place was to be able to compile Lisp to C, I had no
EW> problems compiling gcl, it runs great--but now I want to compile
EW> Lisp programs to C and can not find any documentation anywhere.
have you tried (compile-file "myfile.lisp")? 8-]
(afaik) gcl and ecl first produce C file from lisp, then compile them using
gcc and dyn-load result. with some switches you can say it too keep
temporary C file to see what's in it.
however, it will be not standalone C file - it requires core with library of
Lisp functions. but i think you can link it all into one executable, add C
code there and so on..
)
(With-best-regards '(Alex Mizrahi) :aka 'killer_storm)
(prin1 "Jane dates only Lisp programmers"))