[Openmcl-devel] Questions About Image Saving

Gary Byers gb at clozure.com
Sat Apr 21 06:01:10 UTC 2007


See ccl:examples;cocoa-application.lisp, or Bosco.

(And it's possible that something in the last round of ObjC bridge
changes broke cocoa-application.lisp.  I just tried it, and what
seems to have broken recently is SAVE-APPLICATION: it checks to
see that the containing directory exists, but doesn't handle
logical pathnames correctly when doing so.  With a fix for that
in place, the COCOA-APPLICATION example seems to create a double-clickable
application that starts up without obvious problems; I haven't looked
at logfiles to see if there are non-obvious problems getting logged.)

One of the effects of doing (require 'cocoa) is to change the
class of the initial thread and of some other objects so that
they behave differently in a GUI environment than they did in a
TTY environment.  One of the other things that happens when 
cocoa.lisp is loading is that the bridge becomes aware of the
classes that exist in the Cocoa libraries and integrates them
into CLOS.  This same sort of integration has to happen again
when a saved GUI image starts up: the foreign classes and other
objects may have different addresses than they had when the
image was saved.

There are a number of different ways in which an image "with
Cocoa loaded" could behave.  The "cocoa-application" example
takes one approach (making "ccl:OpenMCL.app" into a double-clickable
application.  One might also want a TTY application that's able
to transform itself into a GUI application a few seconds quicker
than happens when doing (require "cocoa"); that may not be possible
becuase of the way that "faking the bundle path" works; it -might-
work to set the CFProcessPath environment variable in the shell
before starting that image.


The result you see below seems to be the result of something that's
"undergone the tranformation" starting up in a TTY environment and
containing dangling references to ObjC instances from the previous
session.




On Fri, 20 Apr 2007, Brent Fulgham wrote:

> I'm doing something wrong, but I'm not sure what.  I was trying to
> create a Lisp image that already has the Cocoa support present:
>
> Chaz:~ brent$ openmcl
> ; loading system definition from ccl:tools;asdf-install;asdf-
> install.asd.newest into #<Package "ASDF0">
> ; registering #<SYSTEM ASDF-INSTALL #x8581676> as ASDF-INSTALL
> Welcome to OpenMCL Version 1.1-pre-070408 (DarwinPPC32)!
> ? (require 'cocoa)
> ; Note: defining new ObjC message -[PrefsView notePrefsChange:]
> ; Note: defining new ObjC message -[PrefsView commitPrefs:]
> ; Note: defining new ObjC message -[PrefsView revertPrefs:]
> ; Note: defining new ObjC message +[PreferencesPanel sharedPanel]
> ; Note: defining new ObjC message -[PreferencesPanel show]
> ; Note: defining new ObjC message -[NSApplication postEventAtStart:]
> ; Note: defining new ObjC message -[LispApplication showPreferences:]
> ; Note: defining new ObjC message -[LispApplication toggleTypeout:]
> ; Note: defining new ObjC message -[HemlockTextStorage
> editingInProgress]
> ; Note: defining new ObjC message -[HemlockTextStorage noteInsertion:]
> ; Note: defining new ObjC message -[HemlockTextStorage noteDeletion:]
> ; Note: defining new ObjC message -[HemlockTextStorage
> noteModification:]
> ; Note: defining new ObjC message -[HemlockTextStorage noteAttrChange:]
> ; Note: defining new ObjC message -[HemlockTextStorage
> ensureSelectionVisible]
> ; Note: defining new ObjC message -[HemlockTextstorageTextView
> updateSelection:length:affinity:]
> ; Note: defining new ObjC message -[HemlockFrame runErrorSheet:]
> ; Note: defining new ObjC message -[HemlockFrame
> sheetDidEnd:returnCode:contextInfo:]
> ; Note: defining new ObjC message -[HemlockFrame
> sheetDidDismiss:returnCode:contextInfo:]
> ; Note: defining new ObjC message -[HemlockTextStorage
> updateHemlockSelection]
> ; Note: defining new ObjC message -[HemlockListenerWindowController
> gotData:]
> ; Note: defining new ObjC message +[HemlockListenerDocument topListener]
> ; Note: defining new ObjC message -[HemlockListenerDocument interrupt:]
> ; Note: defining new ObjC message -[HemlockListenerDocument backtrace:]
> ; Note: defining new ObjC message -[LispApplicationDelegate
> newListener:]
> COCOA
> ("FAKE-CFBUNDLE-PATH" "OBJC-PACKAGE" "SPLAY-TREE" "NAME-TRANSLATION"
> "OBJC-CLOS" "OBJC-RUNTIME" "BRIDGE" "OBJC-SUPPORT" "COCOA-DEFAULTS"
> "COCOA-PREFS" "COCOA-TYPEOUT" "COCOA-WINDOW" "HEMLOCK" "COCOA-EDITOR"
> "PTY" "COCOA-LISTENER" "COCOA-BACKTRACE" "COCOA")
> ?(ccl:save-application "dppccl.image")
> Chaz:~ brent$
>
> So far, so good.  Now for some fun!
>
> Chaz:~ openmcl
> rocess listener(1).
> > Type :POP to abort, :R for a list of available restarts.
> > Type :? for other options.
> > Error: No applicable method for args:
> >         (#<A Dead Mac Pointer> :ENTER-BACKTRACE-CONTEXT #<SIMPLE-
> VECTOR 11>)
> >         to #<STANDARD-GENERIC-FUNCTION CCL::UI-OBJECT-DO-OPERATION
> #x816C3F6>
> > While executing: #<CCL::STANDARD-KERNEL-METHOD NO-APPLICABLE-
> METHOD (T)>, in process listener(1).
> > Type :POP to abort, :R for a list of available restarts.
> > Type :? for other options.
> > Error: No applicable method for args:
> >         (#<A Dead Mac Pointer> :ENTER-BACKTRACE-CONTEXT #<SIMPLE-
> VECTOR 11>)
> >         to #<STANDARD-GENERIC-FUNCTION CCL::UI-OBJECT-DO-OPERATION
> #x816C3F6>
> > While executing: #<CCL::STANDARD-KERNEL-METHOD NO-APPLICABLE-
> METHOD (T)>, in process listener(1).
> > Type :POP to abort, :R for a list of available restarts.
> > Type :? for other options.
> [ ... etc. ...]
>
> From this, I guess I should not attempt to save a heap image that
> includes the cocoa stuff?
>
> Or am I doing something wrong (yet again!)
>
> Thanks,
>
> -Brent
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
>
>



More information about the Openmcl-devel mailing list