Compiling standalone executables - racket/racket GitHub Wiki
Standalone executables can be created from the command line using raco
or by using "Create Executable" in DrRacket.
What exactly is "standalone"?
Using raco exe
produces an executable that may reference dynamically linked libraries from the system it was built in, including DLLs in the Racket distribution used to build the executable.
Using raco distribute
includes all dynmically linked libraries necessary for the program to run.
The complete DrRacket-based explanation below creates a distribution, intended to run on any computer.
Want to try it?
- Download and install Racket from https://download.racket-lang.org
- Start DrRacket
- Choose the language: The Racket language in the Language dialog. (This shows up the first time you use DrRacket)
- Paste this simple GUI app into DrRacket. (the top 'Definitions' bit - don't forget to replace the
#lang racket
with the#lang racket/gui
so you don't have two#lang ...
lines)
#lang racket/gui
(define my-language 'English)
(define translations
#hash([English . "Hello world"]
[French . "Bonjour le monde"]
[German . "Hallo Welt"]
[Greek . "Γειά σου, κόσμε"]
[Portuguese . "Olá mundo"]
[Spanish . "Hola mundo"]
[Thai . "สวัสดีชาวโลก"]))
(define my-hello-world
(hash-ref translations my-language
"hello world"))
(message-box "" my-hello-world)
- Click the yellow floppy disk icon to save, or use 'Save Definitions' in the
File
menu. - Click the
Create Executable
in theRacket
menu. - For the type, choose
Distribution
to fully package your app to run on other machines. - For base, choose
GRacket
. (don't worry about the files for icons for now) - Click the
Create
button to compile your app.