Compiler Arguments¶
ponyc, the compiler, is usually called in the project directory, where it finds the .pony files and its dependencies automatically. There it will create the binary based on the directory name. You can override this and tune the compilation with several options as described via ponyc --help and you can pass a separate source directory as an argument.
ponyc [OPTIONS] <module directory>
Useful options¶
--debug¶
By default, ponyc optimizes your program. Compiling with --debug skips the LLVM optimization passes and enables debug output from the standard library’s debug package.
Suppose you want to check whether a behaviour runs. You can call Debug.out inside the behaviour without passing it an Env. Save this program in a directory named greeting.
use "debug"
actor Main
new create(env: Env) =>
greet()
be greet() =>
Debug.out("Running greet")
From inside greeting, compile and run the program.
ponyc --debug
./greeting
When greet runs, Debug.out prints Running greet to standard output. Now build the same program with the default options and run it again.
ponyc
./greeting
The greet behaviour still runs, but this time the program exits without printing anything.
You can step through your program with a conventional debugger such as GDB or LLDB. The compiler includes debug symbols by default. Use --strip or -s to omit them.
--path¶
--path or -p take a : separated path list as the argument and adds those to the compile-time library paths for the linker to find source modules and the native libraries, static or dynamic, being linked at compile-time or via the FFI at run-time. The system adds several paths already, e.g. on windows it queries the registry to find the compiler run-time paths, you can also use use "lib:path" statements in the source code and as a final possibility, you can add -p paths. But if you want the generated binary to accept such a path to find a dynamic library on your client system, you need to handle that in your source code by yourself. See the options package for this.
--output¶
--output or -o takes a directory name where the final binary is created.
Runtime options for Pony programs¶
Compiled Pony programs also accept --pony* command-line options that tune the runtime. These are separate from ponyc compiler options. See the Runtime Options chapter for the full list and details.