Compiling

Compiling programs is easy with zc, the ZPL compiler. It will automatically call your system's C compiler and will create a file that you can use to run your program directly.

To compile a program, simply type the program name, with the ".z" extension as an argument to the compiler. For example, to compile the example program Jacobi, and build an executable named jacobi, you would write:

zc jacobi

Optional Arguments

The compiler takes many optional arguments. Some important ones are described here. You can call zc with the -h flag to learn about more arguments.

-cpp   Use cpp to preprocess the input ZPL file.
 
-d   Specify a directory to leave the intermediate C code. See -savec.
 
-D   Specify preprocessor flags to pass to cpp.
 
-h   Display a help message.
 
-I   Add a path to search for #include files.
 
-l   Add libraries to link to during object code compilation.
 
-L   Add a path to search for libraries.
 
-nobuild   Disable the building of binaries.
 
-o   Specify an output file name.
 
-O0   Compile with no optimizations.
 
-O1   Compile with full optimizations.
 
-savec   Save the intermediate C code.
 
-seqonly   Optimize program for sequential runs. The resulting program cannot run in parallel.
 
-v   Show output of the C compiler.
 
-verbose   Print out more information on errors.
 
-V   Display version information and quit.

Compiling External C

The ZPL compiler can also link in C code that is called in the ZPL program through the extern and opaque keywords. Either C code or C object code can be passed to the ZPL compiler. For example, to compile a program foo.z that calls C procedures in a file utilities.c, you would write:

zc foo.z utilities.c