2 Overview
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • Overview
        • Getting started quickly
        • The user's initialisation file
        • Initialisation files and goals
        • Command line options
        • UI Themes
        • GNU Emacs Interface
        • Online Help
        • Command line history
        • Reuse of top-level bindings
        • Overview of the Debugger
        • Compilation
        • Environment Control (Prolog flags)
        • An overview of hook predicates
        • Automatic loading of libraries
        • Packs: community add-ons
          • attach_packs/0
          • attach_packs/1
          • attach_packs/2
        • The SWI-Prolog syntax
        • Rational trees (cyclic terms)
        • Just-in-time clause indexing
        • Wide character support
        • System limits
        • SWI-Prolog and 64-bit machines
        • Binary compatibility
    • Packages

2.15 Packs: community add-ons

SWI-Prolog has a mechanism for easy incorporation of community extensions. See the pack landing page for details and available packs. This section documents the built-in predicates to attach packs. Predicates for creating, registering and installing packs are provided by the library library(prolog_pack).

attach_packs
Attaches all packs in subdirectories of directories that are accessible through the file search path (see absolute_file_name/3) pack. The default for this search path is given below. See file_search_path/2 for the app_data search path.
user:file_search_path(pack, app_data(pack)).

The predicate attach_packs/0 is called on startup of SWI-Prolog.

attach_packs(+Directory)
Attach all packs in subdirectories of Directory. Same as attach_packs(Directory,[]).
attach_packs(+Directory, +Options)
Attach all packs in subdirectories of Directory. Options is one of:
search(+Where)
Determines the order in which pack library directories are searched. Default is to add new packages at the end (last). Using first, new packages are added at the start.
duplicate(+Action)
Determines what happens if a pack with the same name is already attached. Default is warning, which prints a warning and ignores the new pack. Other options are keep, which is like warning but operates silently and replace, which detaches the old pack and attaches the new.

The predicate attach_packs/2 can be used to attach packages that are bundled with an application.