1.11 Creating Executables

► |  | Dr Racket: The Racket Programming Environment

1 | Interface Essentials
2 | Languages
3 | Interface Reference
4 | Extending Dr Racket
| Index

▼ | 1 | Interface Essentials

1.1 | Buttons
1.2 | Choosing a Language
1.3 | Editing with Parentheses
1.4 | Searching
1.5 | Tabbed Editing
1.6 | The Interactions Window
1.7 | Graphical Syntax
1.8 | Graphical Debugging Interface
1.9 | The Module Browser
1.10 | Color Schemes
1.11 | Creating Executables
1.12 | Following Log Messages

Racket
top contents ← prev up next →

### 1.11 Creating Executables🔗ℹ

DrRacket’s Create Executable... menu item lets you create an executable for your program that you can start without first starting DrRacket. To create an executable, first save your program to a file and set the language and teachpacks. Click Run, just to make sure that the program is working as you expect. The executable you create will not have a read-eval-print-loop, so be sure to have an expression that starts your program running in the definitions window before creating the executable.

Once you are satisfied with your program, choose the Create Executable... menu item from the Racket menu. You will be asked to choose an executable file name or an archive file name. In the latter case, unpack the generated archive (on this machine or another one) to access the executable. In either case, you will be able to start the executable in the same way that you start any other program on your computer.

The result of Create Executable... is either a launcher executable, a stand-alone executable, or a distribution archive, and it uses either a Racket (textual) or GRacket (graphical) engine. For programs implemented with certain languages, Create Executable... will prompt you to choose the executable type and engine, while other languages support only one type or engine.

Each type has advantages and disadvantages:

- A launcher executable uses the latest version of your program source file when it starts. It also accesses library files from your DrRacket installation when it runs. Since a launcher executable contains specific paths to access those files, launchers usually cannot be moved from one machine to another.

- A stand-alone executable embeds a compiled copy of your program and any Racket libraries that your program uses. When the executable is started, it uses the embedded copies and does not need your original source file. It may, however, access your DrRacket installation for DLLs, frameworks, shared libraries, or helper executables. Consequently, a stand-alone executable usually cannot be moved from one machine to another.

- A distribution archive packages a stand-alone executable together with any needed DLLs, frameworks, shared libraries, and helper executables. A distribution archive can be unpacked and run on any machine with the same operating system as yours.

DrRacket’s gives you the most options when it infers a language from a program’s source. Most other languages only allow one type of executable. The teaching languages, for example, create stand-alone executables in distributions. The legacy languages create only launchers.

Tip: Disable debugging in the language dialog before creating your executable. With debugging enabled, you will see a stack trace with error messages, but your program will run more slowly. To disable debugging, open the language dialog, click the Show Details button, and select No debugging or profiling, if it is available.

When you create an executable in some languages, you can supply additional files to determine the executable’s icon and similar properties, depending on the platform. The file’s purpose is determined by its suffix:

- On Windows, supply an ".ico" file for an icon. Only 16x16, 32x32, or 48x48 images from the ".ico" file are used.

- On Mac OS, supply an ".icns" file for an icon. You can set the application’s creator with an ".creator" file (whose first four bytes are used), and you can set documents for the application through a ".utiexports" file (see 'uti-exports in create-embedding-executable for more information).

- On Unix, supply a ".png" or ".ico" file for an icon.

top contents ← prev up next →