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:

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: