| Previous Section | Next Section | Table of Contents | Glossary | Index |
You may have noticed that (require "COCOA") takes a long time to load. It is possible to avoid this by saving a Lisp heap image which has everything already loaded. There is an example file which allows you to do this, "ccl/examples/cocoa-application.lisp", by producing a double-clickable application which runs your program. First, load your own program. Then, do:
? (require "COCOA-APPLICATION")
When it finishes, you should be able to double-click the Clozure CL icon in the ccl directory, to quickly start your program.
The OS may have already decided that Clozure CL.app isn't a valid executable bundle, and therefore won't let you double-click it. If this happens to you, to force it to reconsider, just update the last-modified time of the bundle. In Terminal:
> touch Clozure CL.app
There is one important caveat.
Because of the way that the ObjC bridge currently works, a saved image is dependent upon the exact versions of the Cocoa libraries which were present when it was saved. Specifically, the interface database is. So, for example, an application produced under OS X 10.3.5 will not work under OS X 10.3.6. This is inconvenient when you wish to distribute an application you have built this way.
When an image which had contained ObjC classes (which are also CLOS classes) is re-launched, those classes are "revived": all preexisting classes have their addresses updated destructively, so that existing subclass/superclass/metaclass relationships are maintained. It's not possible (and may never be) to preserve foreign instances across SAVE-APPLICATION. (It may be the case that NSArchiver and NSCoder and related classes offer some approximation of that.)
| Previous Section | Next Section | Table of Contents | Glossary | Index |