logtalk_compile(File, Flags) logtalk_compile(Files, Flags)
Compiles to disk a source file or a list of source
files using a list of compiler flags. The Logtalk source file name
extension (by default,
.lgt) can be omitted. Source file paths can
be absolute, relative to the current directory, or use library notation.
This predicate can also be used to compile Prolog source files as
Logtalk source code. When no recognized Logtalk or Prolog extension is
specified, the compiler tries first to append a Logtalk source file
extension and then a Prolog source file extension. If that fails, the
compiler tries to use the file name as-is. Compiler flags are
represented as flag(value). For a description of the available
compiler flags, please see Compiler flags in the User
When this predicate is called from the top-level, relative source file paths are resolved using the current working directory. When the calls are made from a source file, relative source file paths are resolved by default using the source file directory (unless a relative_to flag is passed).
Note that only the errors related to problems in the predicate argument are listed below. This predicate fails when errors are found during compilation of a source file.
The compiler flags specified in the second argument only apply to the files listed in the first argument. Notably, if you are compiling a loader file, the flags only apply to the loader file itself.
Modes and number of proofs¶
logtalk_compile(@source_file_name, @list(compiler_flag)) - zero_or_one logtalk_compile(@list(source_file_name), @list(compiler_flag)) - zero_or_one
permission_error(modify, flag, Flag)
% compile to disk the "list" source file in the % current directory using default compiler flags: | ?- logtalk_compile(list, ). % compile to disk the "tree" source file in the "types" % library directory with the source_data flag turned on: | ?- logtalk_compile(types(tree), [source_data(on)]). % compile to disk the "file_system" source file in the % current directory with portability warnings supressed: | ?- logtalk_compile(file_system, [portability(silent)]).