[ Directives | Reference Manual | Alphabetic Index ]

include(+FileSpec)

Include other files as part of the program source.
FileSpec
File name(s) (atom/string or list of atoms/strings)

Description

Include the contents of other file(s) as if the contents of those file(s) had been inserted in place of the directive. If more than one file is specified, they are included in the order in which they appear in the list FileSpec.

Included files can contain clauses, directives and queries, but should not contain module/1,3 directives (they would be interpreted as occurring within the including file, and the included module would not end at the end of the included file). The correct way to use another module is via the use_module/1 directive.

The square bracket notation [File] can be used as a synonym for include(File) when used as a directive.

To include files that contain only comment/2 directives, it is preferable to use comment(include, File) - the file will then only be included (and needed) by the comment processor, not the compiler.

The rules for expanding the include file names are the same as those used in compile/1,2 regarding suffixes and paths.

Modes and Determinism

Modules

This predicate is sensitive to its module context (tool predicate, see @/2).

See Also

. / 2, comment / 2, library(source_processor)