14. Compilation and Code Loading
14 Compilation and Code Loading
How code is compiled and loaded is not a language issue, but is system-dependent. This section describes compilation and code loading in Erlang/OTP with references to relevant parts of the documentation.
14.1 Compilation
Erlang programs must be compiled to object code. The compiler can generate a new file that contains the object code. The current abstract machine, which runs the object code, is called BEAM, therefore the object files get the suffix .beam
. The compiler can also generate a binary which can be loaded directly.
The compiler is located in the module compile
(see the compile(3)
manual page in Compiler).
compile:file(Module) compile:file(Module, Options)
The Erlang shell understands the command c(Module)
which both compiles and loads