Module Findlib

module Findlib: sig .. end
The primary findlib interface

The Findlib module is the primary interface of the findlib library. It contains functions to look up packages, to interpret META files, and to determine the ancestors of packages.

This module must be initialized before it can be used: Call either init or init_manually for this.

exception No_such_package of string * string
First arg is the package name not found, second arg contains additional info for the user
exception Package_loop of string
A package is required by itself. The arg is the name of the package
val init : ?env_ocamlpath:string ->
?env_ocamlfind_destdir:string ->
?env_ocamlfind_metadir:string ->
?env_ocamlfind_commands:string ->
?env_ocamlfind_ignore_dups_in:string ->
?env_camllib:string ->
?env_ldconf:string -> ?config:string -> ?toolchain:string -> unit -> unit
Initializes the library from the configuration file and the environment. By default the function reads the file specified at compile time, but you can also pass a different file name in the config argument. Furthermore, the environment variables OCAMLPATH, OCAMLFIND_DESTDIR, OCAMLFIND_COMMANDS, and CAMLLIB are interpreted. By default, the function takes the values found in the environment, but you can pass different values using the env_* arguments. By setting these values to empty strings they are no longer considered. The result of the initialization is determined as follows:
val init_manually : ?ocamlc_command:string ->
?ocamlopt_command:string ->
?ocamlcp_command:string ->
?ocamlmklib_command:string ->
?ocamlmktop_command:string ->
?ocamldep_command:string ->
?ocamlbrowser_command:string ->
?ocamldoc_command:string ->
?ignore_dups_in:string ->
?stdlib:string ->
?ldconf:string ->
install_dir:string ->
meta_dir:string -> search_path:string list -> unit -> unit
This is an alternate way to initialize the library directly. Environment variables and configuration files are ignored.
val default_location : unit -> string
Get the default installation directory for packages
val meta_directory : unit -> string
Get the META installation directory for packages. Returns "" if no such directory is configured.
val search_path : unit -> string list
Get the search path for packages
val command : [ `ocamlbrowser
| `ocamlc
| `ocamlcp
| `ocamldep
| `ocamldoc
| `ocamlmklib
| `ocamlmktop
| `ocamlopt ] -> string
Get the name/path of the executable
val ocaml_stdlib : unit -> string
Get the directory of the standard library
val ocaml_ldconf : unit -> string
Get the file name of ld.conf
val package_directory : string -> string
Get the absolute path of the directory where the given package is stored.

Raises No_such_package if the package cannot be found.

val ignore_dups_in : unit -> string option
If Some d, duplicate packages below d are ignored, and do not produce warnings. (Only affects the generation of warnings.)
val package_property : string list -> string -> string -> string
package_property predlist pkg propname: Looks up the property propname of package pkg under the assumption that the predicates in predlist are true.

Raises No_such_package if the package, and Not_found if the property cannot be found.


val package_ancestors : string list -> string -> string list
package_ancestors predlist pkg: Determines the direct ancestors of package pkg under the assumption that the predicates in predlist are true, i.e. the names of the packages required by pkg. The returned list is unsorted.

Raises No_such_package if the package pkg or one of its ancestors could not be found.

val package_deep_ancestors : string list -> string list -> string list
package_deep_ancestors predlist pkglist: determines the list of direct or indirect ancestors of the packages named in pkglist under the assumption that the predicates in predlist are true.

The returned list is topologically sorted: The first element is the deepest ancestor; the last element is one of pkglist.

Raises No_such_package if one of the packages in pkglist or one of the ancestors cannot be found. Raises Package_loop if there is a cyclic dependency.

val resolve_path : ?base:string -> string -> string
Resolves findlib notation in filename paths. The notation +name/path can be used to refer to the subdirectory name of the standard library directory; the continuation /path is optional. The notation @name/path can be used to refer to the directory of the package name; the continuation /path is optional. For these two notations, absolute paths are returned.

base : When the function is applied on a relative path, the base path is prepended. Otherwise, the path is returned as it is.
val list_packages : ?tab:int -> ?descr:bool -> Pervasives.out_channel -> unit
Prints the list of available packages to the out_channel.

tab : The tabulator width, by default 20
descr : Whether package descriptions are printed. Default: false