[Openmcl-devel] Trouble with save-application
gb at clozure.com
Fri Jun 15 12:11:40 EDT 2007
None of this is documented, and large chunks of it aren't finished.
The general (handwavy) idea is that the image by default contains
a certain type of application (a "lisp development system"), and
that it should be possible to create an image that contains a
different class of application by defining that class and defining
a few methods.
? (defclass hello-world-application (ccl::application) ())
? (defmethod toplevel-function ((app hello-world-application) init-file)
(declare (ignore init-file))
(call-next-method) ; this is critical, but shouldn't be.
(format t "~& hello world")
;;; Tell SAVE-APPLICATION what class of application the saved image
;;; will be.
? (save-application "hello-world.image" :application-class 'hello-world-application)
shell> openmcl64 -I hello-world.image
That works (as far as it goes), but if you want to do something more
elaborate, it gets complicated and a lot of this just isn't ready for
The CALL-NEXT-METHOD in the definition of the method above is critical:
the superclass's method does a lot of things (reinitializing streams,
etc.) That stuff is critical to practically any application, but it
isn't always possible to invoke it via CALL-NEXT-METHOD.
On Fri, 15 Jun 2007, Jared C. Davis wrote:
> I am trying to create a lisp image which runs a "main" function at
> startup. Here is how I created the image:
> (defun main ()
> (format t "Hello, world!")
> (CCL::save-application "hello-world.image" :toplevel-function #'main)
> This successfuly creates the hello-world.image file, but when I try to
> use the image I get this error:
> [jared at lhug-1 OpenMCL]$ openmcl -I hello-world.image
> Error during early application initialization:
> value #<A Dead Mac Pointer> is not of the expected type MACPTR.
> ? for help
>  OpenMCL kernel debugger:
> I am using 1.1-pre-070512 (LinuxX8664). I'm not sure if I've done
> something wrong or if this is a bug, so in case it's a bug here is the
> current thread: tcr = 0x2b2baac46de0, native thread ID = 0x66be,
> interrupts enabled
> (#x00002B2BAAE58CF8) #x000030004055281C : #<Anonymous Function
> #x000030004055192F> + 3821
> (#x00002B2BAAE58D58) #x00003000404B2C3C : #<Function
> FUNCALL-WITH-ERROR-REENTRY-DETECTION #x00003000404B2B6F> + 205
> (#x00002B2BAAE58D98) #x0000300040552D54 : #<Function %XERR-DISP
> #x0000300040552B7F> + 469
> (#x00002B2BAAE58DD0) #x0000300040126754 : #<Function
> %PASCAL-FUNCTIONS% #x00003000401265BF> + 405
> Bogus frame 2b2baae58e28
>  OpenMCL kernel debugger:
> I can work around this by taking out the :toplevel-function parameter
> and adding the -e option to the command line, i.e.,
> openmcl -I hello-world.image -e "(main)"
> But I'd ideally like to get the main function built right into the image.
> Jared C. Davis <jared at cs.utexas.edu>
> 3600 Greystone Drive #604
> Austin, TX 78731
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
More information about the Openmcl-devel