1) What is the proper method to make an image in ccl? Or what is the exact difference between:
(compile-file "foo.lisp") and (progn (load "foo.lisp") (save-application "foo"))?
2) Is there any possibility to load multiple images (command line prefered)?
The file compiler in Common Lisp systems creates a representation of the original source in some kind of machine language (depending on the target processor) or for some virtual machine (for example in CLISP). This compiled file then can be loaded into a running Lisp system with the LOAD function and creates the definitions of the source (functions, classes, variables, ...) and executes other code in the file.
One can load source files directly (also using the function LOAD). If the Lisp uses a compiler even for loading forms, the advantage of the file compiler is:
Saving an image is independent. The image is a memory dump of a running Lisp. But generally not every state can be dumped depending on the Lisp system. Candidates of things that cannot be dumped to an image: file connections, network connections, open windows, ... So, these things may need to be reopened when an image is started.
If you want to start a Lisp application one has several options:
The latter is likely the fastest. For many purposes now loading compiled code at startup is also fast enough, especially if starting only happens once in a while.
Let's look at your question again.
(compile-file "foo.lisp")
Above just compiles a single file to a compiled file (FASL file, 'fast load'). The effect of the compilation is also that some information has been recorded in the Lisp system, but the definitions of the file are not available. You need to load the compiled file then.
(progn (load "foo.lisp") (save-application "foo"))
Above first loads the file. Note that a Lisp with an incremental compiler may compile some or all statements in that file (CCL and SBCL are doing that). SAVE-APPLICATION is a CCL specific function, which dumps the complete Lisp state (minus file connections, ...) and creates an application which then can be started.
If you want to create Lisp applications that start like other applications, SAVE-APPLICATION is the way to go.
If multiple images can be loaded is system dependent. In CCL you can't. On a Lisp Machine one could load a base image and then multiple incremental images on top of that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With