1.2 Bytecode Files

► |  | raco: Racket Command-Line Tools

1 | raco make: Compiling Source to Bytecode
2 | raco exe: Creating Stand-Alone Executables
3 | raco distribute: Sharing Stand-Alone Executables
4 | raco planet: Automatic Package Distribution
5 | raco pkg: Package Management
6 | raco setup: Installation Management
7 | raco decompile: Decompiling Bytecode
8 | raco demod: Demodularizing Programs
9 | raco link: Library Collection Links
10 | raco pack: Packing Library Collections
11 | raco unpack: Unpacking Library Collections
12 | raco ctool: Working with C Code
13 | raco test: Run tests
14 | raco docs: Documentation Search
15 | raco expand: Macro Expansion
16 | raco read: Reading and Pretty-Printing
17 | raco scribble: Building Documentation
18 | Adding a raco Command
19 | Installation Configuration and Search Paths

▼ | 1 | raco make: Compiling Source to Bytecode

1.1 | Running raco make
1.2 | Bytecode Files
1.3 | Dependency Files
1.4 | API for Making Bytecode
1.5 | API for Parallel Builds
1.6 | Compilation Manager Hook for Syntax Transformers
1.7 | API for Simple Bytecode Creation
1.8 | API for Bytecode Paths
1.9 | Compiling to Raw Bytecode
1.10 | API for Raw Compilation
1.11 | API for Reading Compilation Dependencies

top ← prev up next →

#### 1.2`` Bytecode Files

A file "‹name›.‹ext›" is compiled to bytecode that is saved as "compiled/‹name›_‹ext›.zo" relative to the file. As a result, the bytecode file is normally used automatically when "‹name›.‹ext›" is required as a module, since the underlying load/use-compiled operation detects such a bytecode file.

For example, in a directory that contains the following files:

- "a.rkt":

  > #lang racket
  > (require "b.rkt" "c.rkt")
  > (+ b c)

- "b.rkt":

  > #lang racket
  > (provide b)
  > (define b 1)

- "c.rkt":

  > #lang racket
  > (provide c)
  > (define c 1)

then

raco make a.rkt

triggers the creation of "compiled/a_rkt.zo", "compiled/b_rkt.zo", and "compiled/c_rkt.zo". A subsequent

racket a.rkt

loads bytecode from the generated ".zo" files, paying attention to the ".rkt" sources only to confirm that each ".zo" file has a later timestamp (unless the PLT_COMPILED_FILE_CHECK environment variable is set to exists, in which case the compiled file is used without a timestamp check).

In contrast,

raco make b.rkt c.rkt

would create only "compiled/b_rkt.zo" and "compiled/c_rkt.zo", since neither "b.rkt" nor "c.rkt" imports "a.rkt".

top ← prev up next →