[previous] [up] [next]     [contents] [index]
Next: Compiling Multiple Files to Up: Compiling Individual Files with Previous: Prefixing Compilation with Macro

Autodetecting Compiled Files for Loading

When MzScheme's load/use-compiled, load-relative, or require-library procedure is used to load a file, MzScheme automatically detects byte code and/or native code compiled files that are kept close to the requested file. Byte code files are found in a compiled subdirectory in the directory of the requested file. Native code files are found in (build-path dir "compiled" "native" (system-library-subpath)) where dir is the directory of the requested file. A byte code or native code file is only used if its modification date is later than the requested file. If both byte code and native code files are found, the native code file is loaded.

For example:

  mzc --extension --destination compiled native i386-linux file.ss 
Under Linux, the above command compiles file.ss in the current directory and produces compiled/native/i386-linux/file.so. Evaluating (load/use-compiled "file.ss") in MzScheme will then load compiled/native/i386-linux/file.so instead of file.ss. If file.ss is changed without recreating file.so, then load/use-compiled loads file.ss since file.so is out-of-date.



PLT