Export to GitHub

ect - Compilation.wiki


To compile a module that uses the ECT extended syntax, two things are required: 1. The ECT include directory has to be in the include path of the compiler. 1. The ECT binary directory has to be in the Erlang code path

Erlang code path

This can be specified the same way for Elang shell, and Erlang compiler: erl -pz /path/to/ect/ebin erlc -pz /path/to/ect/ebin something.erl

Compiler include path

Actually, the directory where ECT is installed is needed to be in the include path. This can be achieved in several different ways: * You can either install ECT in a directory which is already in the include path. * Or use the following compiler switch: {i, "/path/to/ectdir"}. For example: * erlc -I/path/to/ectdir something.erl * In the Erlang shell: c(something, [{i, "/path/to/ectdir"}. In the second case, the path to ECT includes can be determined the following way: 1. Locate the include directory of ECT, where ect.hrl can be found. 1. The directory to specify is the second parent of this, e.g.: if you find /home/bela/tests/ect/include/ect.hrl, then you have to specify /home/bela/tests for the compiler.

Examples

erlc -pz /home/bela/tests/etc/ebin -I /home/bela/tests something.erl

``` erl -pz /home/bela/tests/etc/ebin Erlang R13B01 ...

Eshell V5.7.2 (abort with ^G) 1> c(something, [{i, "/path/to/ectdir"}]). ```

Compiler switches for ECT

These switches can be passed ECT the following two ways: erlc -pz ... -I ... +Switch1 +Switch2 ... something.erl or in the Erlang shell: c(something, [{i, ...}, Switch1, Switch2, ...])

The following switches are available: * verbosity {verbose, true}
{verbose, false} - default
* selection of transformation backend {cctrans, cctrans} - default {cctrans, cctrans0} - understands only a subset of ECT language, used for bootstrap when compiling ECT * specify a path where to write the generated header files of class (*.class.hrl files) {ectheader, "path"} * force variable boundness checking (used for debugging of ECT) force_boundvar_checks