Page 1 of 1

compiling an executable = lisp + your code?

Posted: Tue Apr 06, 2010 7:28 am
by Gradualore
I became curious lately how to build an executable with Lisp. From what I can understand so far, when you compile a Lisp program (to a standalone executable...), you're basically stuffing your own code along with the entire Lisp implementation you're using into a stand alone exe that runs a function of your choice as an entry point when it starts up. Is that right?

Re: compiling an executable = lisp + your code?

Posted: Tue Apr 06, 2010 8:03 am
by nuntius
More or less.

Some commercial implementations also include a "tree shaker" that can help remove parts of the implementation that are not used in your code.

Three ways to distribute a CL app:
- CL executable + sources
- CL executable + compiled sources (fasls)
- CL executable linked with compiled sources (e.g. sbcl's save-lisp-and-die)

For free implementations, it is common to use a shell script (or MS batch file) to glue these together. See for example cl-launch.

Re: compiling an executable = lisp + your code?

Posted: Fri Apr 09, 2010 1:09 am
by jjgarcia
Gradualore wrote:I became curious lately how to build an executable with Lisp. From what I can understand so far, when you compile a Lisp program (to a standalone executable...), you're basically stuffing your own code along with the entire Lisp implementation you're using into a stand alone exe that runs a function of your choice as an entry point when it starts up. Is that right?
ECL (http://ecls.sourceforge.net) is shipped as a shared library that is linked against your compiled program. The library is tiny (about 2MB without debug information) but it does contain all of Common Lisp -- not such a big overhead. Programs can easily be built using our ASDF extensions http://ecls.sourceforge.net/new-manual/ch16.html