views:

607

answers:

1

Given a simple program such as the following, how would you:

  1. compile it as a seperate image file to be loaded by the implementation, and what command line arguments would you use to load it?

  2. Compile it as a standalone binary that can be loaded and run as is.

    Note: I tried adding ":prepend-kernel t" when saving the application only to have the follow error thrown.

    Error: value NIL is not of the
    expected type REAL. While executing: 
    CCL::<-2, in process Initial(0).
    
  3. How would you supress the welcome message?

    The Program

    (defun main ()
      (format t "This is the program.")0)
    

Edit

Hate to answer part of my own question, but I found it none the less.

After the function has been loaded type the following to compile it:

(ccl:save-application "app")

This creates an image file. To load it by passing it to the implementation type (note: the 'ccl' binary is in my system path);

ccl -I app

To run a top level function pass it as a parameter

ccl -I app --eval (main)
+8  A: 

See the Clozure Common Lisp documentation under Saving Applications

You can compile a file /foo/bar.lisp by calling

 (compile-file "/foo/bar.lisp")

You can load the compiled file with the function LOAD.

You can save an application by calling

(save-application "/foo/bar-image" :toplevel-function #'main)

This will save an image, that you can run using the ccl kernel: ccl -I /foo/bar-image

To save an executable that includes the kernel use this:

(save-application "/foo/bar-app" :toplevel-function #'main :prepend-kernel t)

You can call the executable as usual with /foo/bar-app .

In Clozure Common Lisp you can check

*command-line-argument-list*

for the list of command line arguments.

Rainer Joswig
Fixed the mistake.Also, the application was created as expected, but when I tried to load the exe an error message told me that the "Program too big to fit in memory". Have you run into this before? Know of a fix?
Douglas Brunner
see my edit, use prepend-kernel to add the kernel to the file
Rainer Joswig
I was testing all of this on their Windows Implementation and received the various errors mentioned. I just tested it on a Linux machine and it all works as expected. Thanks.
Douglas Brunner
make sure you have the latest version of CCL on Windows (update from the repository). If that does not work, don't hesitate to report this as a bug on the CCL mailing list or their bugtracker.
Rainer Joswig
As soon as I have time ;)
Douglas Brunner