compiling an executable = lisp + your code?

Discussion of Common Lisp
Post Reply
Gradualore
Posts: 3
Joined: Sat Mar 13, 2010 2:10 pm

compiling an executable = lisp + your code?

Post by Gradualore » Tue Apr 06, 2010 7:28 am

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?

nuntius
Posts: 538
Joined: Sat Aug 09, 2008 10:44 am
Location: Newton, MA

Re: compiling an executable = lisp + your code?

Post by nuntius » Tue Apr 06, 2010 8:03 am

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.

jjgarcia
Posts: 38
Joined: Mon Oct 13, 2008 2:48 pm

Re: compiling an executable = lisp + your code?

Post by jjgarcia » Fri Apr 09, 2010 1:09 am

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

Post Reply