Version 11 (modified by mikel, 6 years ago) (diff)


Building the Application

Both the user interface and the behavior of the Currency Converter are complete now. All that remains for us to do is to build the application executable into a Cocoa application bundle. Apple's tutorial relies on XCode to build the application from Objective-C source files; we will use the Clozure CL IDE to build it from our Lisp source file.

We build the application using the optional BUILD-APPLICATION feature, distributed as part of Clozure CL. The steps to build the Cocoa application are:

  1. Launch the Clozure CL IDE. It's safest to build the application with a fresh IDE session, so if you have it running, you may wish to quit and relaunch before following the rest of the steps.
  1. For convenience, set the working directory to your "currency-converter" folder. For example, you can do something like this (using your pathnames in place of mine, of course:):
(setf (current-directory) "/Users/mikel/Valise/clozure/openmcl/example-code/currency-converter/")
  1. Load the application code:
(load "currency-converter")
  1. Load the BUILD-APPLICATION feature:
(require "build-application")
  1. Run BUILD-APPLICATION (be sure to correct the pathname to your CurrencyConverter? nibfile. It is safest to use a full, absolute pathname—not the relative pathname you see below):
(ccl::build-application :name "CurrencyConverter"
                        :main-nib-name "CurrencyConverter"

By default, BUILD-APPLICATION constructs the application bundle in the current working directory. If you followed the instructions here, that means it will build in your currency-converter folder. You can control where BUILD-APPLICATION puts the application bundle by passing a pathname as the value of the keyword argument :DIRECTORY, like so:

(ccl::build-application :name "CurrencyConverter"
                        :directory #P"/Users/mikel/Desktop/"
                        :main-nib-name "CurrencyConverter"

If all goes well, BUILD-APPLICATION constructs an application bundle, copies "CurrencyConverter.nib" into it, writes the application executable, and quits. You should now be able to launch by double-clicking the application icon:

The !CurrencyConverter application launches and displays your user interface, which you can then use to convert currencies:

!Currency Converter UI

Correcting the Application Name

You'll notice when you run the application that, even though you named it CurrencyConverter, the name in the main menu appears as "Clozure CL". That's because OS X takes the application's name, not from the application bundle's name, nor from the running code, but from an InfoPlist.strings file hidden inside the application bundle. To make the name appear correctly in the running application, you need to edit the file

Find the entry named "CFBundleName" and change its value from "Clozure CL" to "CurrencyConverter". The application's name in the main menu bar should now appear correctly, as "CurrencyConverter". You may also want to change the other strings in the "InfoPlist.strings" file.

Start Previous [ Next]


  • cc1.jpg Download (53.0 KB) - added by mikel 6 years ago. The CurrencyConverter application
  • cc2.jpg Download (57.1 KB) - added by mikel 6 years ago. !Currency Converter UI