► |  | 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

top ← 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.

In general, 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.

top ← prev up next →