---
name: "Load_path"
section: "3o"
platform: "linux"
package: "ocaml"
version: "5.5.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/Load_path"
---

# Load\_path(3o)

Management of include directories.

## NAME

Load\_path - Management of include directories.

## Module

Module   Load\_path

## Documentation

Module **Load\_path**\
  :  **sig end**

Management of include directories.

This module offers a high level interface to locating files in the load path, which is constructed from  **-I** and  **-H** command line flags and a few other parameters.

It makes the assumption that the contents of include directories doesn't change during the execution of the compiler.

*val add\_dir* :  **hidden:bool -\> string -\> unit**

Add a directory to the end of the load path (i.e. at lowest priority.)

*val remove\_dir* :  **string -\> unit**

Remove a directory from the load path

*val reset* :  **unit -\> unit**

Remove all directories

*module Dir :* **sig end**

*type auto\_include\_callback* =  **(Dir.t -\> string -\> string option) -\> string -\> string**

The type of callback functions on for  **init ~auto\_include**

*val no\_auto\_include* :  **auto\_include\_callback**

No automatic directory inclusion: misses in the load path raise  **Not\_found** as normal.

*val init* :  **auto\_include:auto\_include\_callback -\>** **visible:string list -\> hidden:string list -\> unit**

**init ~visible ~hidden** is the same as **reset ();**\
      **List.iter add\_dir (List.rev hidden);**\
      **List.iter add\_dir (List.rev visible)**

*val auto\_include\_otherlibs* :  **(string -\> unit) -\> auto\_include\_callback**

**auto\_include\_otherlibs alert** is a callback function to be passed to **Load\_path.init** and automatically adds  **-I +lib** to the load path after calling  **alert lib** .

*val get\_path\_list* :  **unit -\> string list**

Return the list of directories passed to  **add\_dir** so far.

*type paths* = {\
  visible :  **string list** ;\
  hidden :  **string list** ;\
  }

*val get\_paths* :  **unit -\> paths**

Return the directories passed to  **add\_dir** so far.

*val find* :  **string -\> string**

Locate a file in the load path. Raise  **Not\_found** if the file cannot be found. This function is optimized for the case where the filename is a basename, i.e. doesn't contain a directory separator.

*val find\_normalized* :  **string -\> string**

Same as  **find** , but search also for normalized unit name (see **Misc.normalized\_unit\_filename** ), i.e. if name is  **Foo.ml** , allow **/path/Foo.ml** and  **/path/foo.ml** to match.

*type visibility* =\
  \| Visible\
  \| Hidden

*val find\_normalized\_with\_visibility* :  **string -\> string \* visibility**

Same as  **find\_normalized** , but also reports whether the cmi was found in a -I directory (Visible) or a -H directory (Hidden)

*val add* :  **Dir.t -\> unit**

**Deprecated.**

Old name for  **Load\_path.append\_dir**

*val append\_dir* :  **Dir.t -\> unit**

**append\_dir d** adds  **d** to the end of the load path (i.e. at lowest priority.

*val prepend\_dir* :  **Dir.t -\> unit**

**prepend\_dir d** adds  **d** to the start of the load path (i.e. at highest priority.

*val get\_visible* :  **unit -\> Dir.t list**

Same as  **get\_paths ()** , except that it returns a  **Dir.t list** , and doesn't include the -H paths.
