Joy Online Manual

NAME
precompile - Precompile an Objective-C header file for faster #import into Joy

SYNOPSIS

precompile("file"[,"output"])

DESCRIPTION
This function will search for the header file file in the same way as #import <file>. Of course you can also specify file as an absolute path.

The file will then be piped through the C compiler with the following compiler options:

-E -dD -traditional-cpp -D__JOY__=version

You can specify additional options via the environment variable JOY_CC_FLAGS. Also, Joy will automatically add a -I or -F flag for each directory in the environment variables JOY_HEADER_PATH and JOY_FRAMEWORK_PATH, respectively.

The output from the C preprocessor will then be sourced into a temporary JavaScript scope. If no compilation errors occur, Joy will then dump all macros, enum constants, functions, function prototypes, variable and typedef declarations in that scope, as well as information about which header files were imported, into the file output, or by default into ~/Library/Joy/PrecompiledHeaders/file with file's extension replaced by .jp.

If you later #import <file> from Joy code, it will load much faster, and also all the symbols and declarations from the header file will be resolved lazily on demand, so no memory is wasted on header file contents that you do not use.

Every Joy interpreter will automatically import the file itkDefaultHeaders.jp, which is a resource of the itkRuntime.framework, on startup. That file will contain at least the whole AppKit.h as well as prototypes for the ANSI-C library; it was generated with precompile from the source file itkDefaultHeaders.h (in the same resources folder).

SEE ALSO
Header files

Index