[Openmcl-devel] save-application

Gary Byers gb at clozure.com
Thu Oct 23 17:25:58 PDT 2014


One possible sourcce of confusion is that SAVE-APPLICATION is misnamed;  
a better name might be something like "SAVE-HEAP-IMAGE".  A "heap  
image" is a file that contains lisp data and compiled lisp code and a  
little bit of metainformation in some simple ad hoc format that's  
supposed to be easy to map into memory.

The :native t option only works on OSX; it saves the same information  
in a native OSX
shared library.  (Such files often have an extension of ".dylib")  The  
only advantages that I know of to mapping the lisp code and data from a  
.dylib rather than from a heap image file are (a) some profiling tools  
that Apple used to provide can't understand how executable code that  
it's profiling got mapped into memory unless it was mapped from a  
.dylib and (b) some other tools - the gdb debugger - can recognize lisp  
function names more easily if some debugging info is present in the  
.dylib file.

Whether it comes from an image file or from a native shared library,  
you can't directly execute the code directly from the shell; you can  
execute the CCL kernel from the shell and CCL kernel] can map an image  
file (or a .dylib with certain contents) into its address space and  
call the compiled lisp code that it contains.  You can either run the  
CCL kernel from the shell and tell it to try to load a non-default  
image by using the -I option when running CCL or (as Tim Bradshaw  
suggested) tell SAVE-APPLICATION to prepend the running kernel to the  
image (in which case the resulting file contains both an executable  
program and a heap image.)

If you try to execute some file from a Unix shell and the shell and the  
shell doesn't know how to execute it, you'll get a (possibly cryptic)  
error message; this is true whether CCL is involved or not.

I actually think that (at least as far as the above goes) what the CCL  
documentation says about what SAVE-APPLICATION does is accurate and  
intelligble; see section 4.9.


On 10/23/2014 03:10:14 PM, Tim Bradshaw wrote:
> 
> On 23 Oct 2014, at 21:36, Devon Sean McCullough <OpenMCL at jovi.net>  
> wrote:
> 
> >
> > $ ccl -e '(save-application "ccl-app-native" :toplevel-function  
> (lambda () (print "ccl-app-native")) :native t)'
> 
> 
> You want
> 
> (save-application "ccl-app-native"
>                   :toplevel-function (lambda () (print  
> "ccl-app-native"))
>                   :prepend-kernel t)
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> https://lists.clozure.com/mailman/listinfo/openmcl-devel
> 
> 




More information about the Openmcl-devel mailing list