<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <link rel="stylesheet" href="style.css" type="text/css"> <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> <link rel="Start" href="index.html"> <link rel="next" href="Fl_package_base.html"> <link rel="Up" href="index.html"> <link title="Index of types" rel=Appendix href="index_types.html"> <link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> <link title="Index of values" rel=Appendix href="index_values.html"> <link title="Index of modules" rel=Appendix href="index_modules.html"> <link title="Findlib" rel="Chapter" href="Findlib.html"> <link title="Fl_package_base" rel="Chapter" href="Fl_package_base.html"> <link title="Fl_metascanner" rel="Chapter" href="Fl_metascanner.html"> <link title="Topfind" rel="Chapter" href="Topfind.html"><title>The Findlib Library : Findlib</title> </head> <body> <div class="navbar"> <a href="index.html">Up</a> <a href="Fl_package_base.html">Next</a> </div> <center><h1>Module <a href="type_Findlib.html">Findlib</a></h1></center> <br> <pre><span class="keyword">module</span> Findlib: <code class="code">sig</code> <a href="Findlib.html">..</a> <code class="code">end</code></pre>The primary findlib interface <p> 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. <p> This module must be initialized before it can be used: Call either <code class="code">init</code> or <code class="code">init_manually</code> for this.<br> <hr width="100%"> <pre><span class="keyword">exception</span> <a name="EXCEPTIONNo_such_package"></a>No_such_package <span class="keyword">of</span> <code class="type">string * string</code></pre> <div class="info"> First arg is the package name not found, second arg contains additional info for the user<br> </div> <pre><span class="keyword">exception</span> <a name="EXCEPTIONPackage_loop"></a>Package_loop <span class="keyword">of</span> <code class="type">string</code></pre> <div class="info"> A package is required by itself. The arg is the name of the package<br> </div> <pre><span class="keyword">val</span> <a name="VALinit"></a>init : <code class="type">?env_ocamlpath:string -><br> ?env_ocamlfind_destdir:string -><br> ?env_ocamlfind_metadir:string -><br> ?env_ocamlfind_commands:string -><br> ?env_ocamlfind_ignore_dups_in:string -><br> ?env_camllib:string -><br> ?env_ldconf:string -> ?config:string -> ?toolchain:string -> unit -> unit</code></pre><div class="info"> 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 <code class="code">config</code> 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 <code class="code">env_*</code> arguments. By setting these values to empty strings they are no longer considered. The result of the initialization is determined as follows:<ul> <li>The default installation directory is the env variable OCAMLFIND_DESTDIR (if present and non-empty), and otherwise the variable <code class="code">destdir</code> of the configuration file.</li> <li>The installation directory for META files is read from the env variable OCAMLFIND_METADIR (if present and non-empty), and otherwise from the variable <code class="code">metadir</code> of the configuration file, and otherwise no such directory is used. The special value <code class="code">"none"</code> turns this feature off.</li> <li>The search path is the concatenation of the env variable OCAMLPATH and the variable <code class="code">path</code> of the config file</li> <li>The executables of (ocamlc|ocamlopt|ocamlcp|ocamlmktop) are determined as follows: if the env variable OCAMLFIND_COMMANDS is set and non-empty, its contents specify the executables. Otherwise, if the config file variables <code class="code">ocamlc</code>, <code class="code">ocamlopt</code>, <code class="code">ocamlcp</code> and <code class="code">ocamlmktop</code> are set, their contents specify the executables. Otherwise, the obvious default values are chosen: <code class="code">"ocamlc"</code> for <code class="code">ocamlc</code>, <code class="code">"ocamlopt"</code> for <code class="code">ocamlopt</code>, and so on.</li> <li>The directory of the standard library is the value of the environment variable CAMLLIB (or OCAMLLIB), or if unset or empty, the value of the configuration variable <code class="code">stdlib</code>, or if unset the built-in location</li> <li>The <code class="code">ld.conf</code> file (configuring the dynamic loader) is the value of the environment variable OCAMLFIND_LDCONF, or if unset or empty, the value of the configuration variable <code class="code">ldconf</code>, or if unset the built-in location.</li> </ul> <br> </div> <pre><span class="keyword">val</span> <a name="VALinit_manually"></a>init_manually : <code class="type">?ocamlc_command:string -><br> ?ocamlopt_command:string -><br> ?ocamlcp_command:string -><br> ?ocamlmktop_command:string -><br> ?ocamldep_command:string -><br> ?ocamlbrowser_command:string -><br> ?ocamldoc_command:string -><br> ?ignore_dups_in:string -><br> ?stdlib:string -><br> ?ldconf:string -><br> install_dir:string -><br> meta_dir:string -> search_path:string list -> unit -> unit</code></pre><div class="info"> This is an alternate way to initialize the library directly. Environment variables and configuration files are ignored.<br> </div> <pre><span class="keyword">val</span> <a name="VALdefault_location"></a>default_location : <code class="type">unit -> string</code></pre><div class="info"> Get the default installation directory for packages<br> </div> <pre><span class="keyword">val</span> <a name="VALmeta_directory"></a>meta_directory : <code class="type">unit -> string</code></pre><div class="info"> Get the META installation directory for packages. Returns <code class="code">""</code> if no such directory is configured.<br> </div> <pre><span class="keyword">val</span> <a name="VALsearch_path"></a>search_path : <code class="type">unit -> string list</code></pre><div class="info"> Get the search path for packages<br> </div> <pre><span class="keyword">val</span> <a name="VALcommand"></a>command : <code class="type">[ `ocamlbrowser<br> | `ocamlc<br> | `ocamlcp<br> | `ocamldep<br> | `ocamldoc<br> | `ocamlmktop<br> | `ocamlopt ] -> string</code></pre><div class="info"> Get the name/path of the executable<br> </div> <pre><span class="keyword">val</span> <a name="VALocaml_stdlib"></a>ocaml_stdlib : <code class="type">unit -> string</code></pre><div class="info"> Get the directory of the standard library<br> </div> <pre><span class="keyword">val</span> <a name="VALocaml_ldconf"></a>ocaml_ldconf : <code class="type">unit -> string</code></pre><div class="info"> Get the file name of <code class="code">ld.conf</code><br> </div> <pre><span class="keyword">val</span> <a name="VALpackage_directory"></a>package_directory : <code class="type">string -> string</code></pre><div class="info"> Get the absolute path of the directory where the given package is stored. <p> Raises <code class="code">No_such_package</code> if the package cannot be found.<br> </div> <pre><span class="keyword">val</span> <a name="VALignore_dups_in"></a>ignore_dups_in : <code class="type">unit -> string option</code></pre><div class="info"> If <code class="code">Some d</code>, duplicate packages below <code class="code">d</code> are ignored, and do not produce warnings. (Only affects the generation of warnings.)<br> </div> <pre><span class="keyword">val</span> <a name="VALpackage_property"></a>package_property : <code class="type">string list -> string -> string -> string</code></pre><div class="info"> <code class="code">package_property predlist pkg propname</code>: Looks up the property <code class="code">propname</code> of package <code class="code">pkg</code> under the assumption that the predicates in <code class="code">predlist</code> are true. <p> Raises <code class="code">No_such_package</code> if the package, and <code class="code">Not_found</code> if the property cannot be found. <p> EXAMPLES:<ul> <li><code class="code">package_property [] "p" "requires":</code> get the value of the <code class="code">requires</code> clause of package <code class="code">p</code></li> <li><code class="code">package_property [ "mt"; "byte" ] "p" "archive":</code> get the value of the <code class="code">archive</code> property of package <code class="code">p</code> for multi- threaded bytecode applications.</li> </ul> <br> </div> <pre><span class="keyword">val</span> <a name="VALpackage_ancestors"></a>package_ancestors : <code class="type">string list -> string -> string list</code></pre><div class="info"> <code class="code">package_ancestors predlist pkg:</code> Determines the direct ancestors of package <code class="code">pkg</code> under the assumption that the predicates in <code class="code">predlist</code> are true, i.e. the names of the packages required by <code class="code">pkg</code>. The returned list is unsorted. <p> Raises <code class="code">No_such_package</code> if the package <code class="code">pkg</code> or one of its ancestors could not be found.<br> </div> <pre><span class="keyword">val</span> <a name="VALpackage_deep_ancestors"></a>package_deep_ancestors : <code class="type">string list -> string list -> string list</code></pre><div class="info"> <code class="code">package_deep_ancestors predlist pkglist:</code> determines the list of direct or indirect ancestors of the packages named in <code class="code">pkglist</code> under the assumption that the predicates in <code class="code">predlist</code> are true. <p> The returned list is topologically sorted: The first element is the deepest ancestor; the last element is one of <code class="code">pkglist</code>. <p> Raises <code class="code">No_such_package</code> if one of the packages in <code class="code">pkglist</code> or one of the ancestors cannot be found. Raises <code class="code">Package_loop</code> if there is a cyclic dependency.<br> </div> <pre><span class="keyword">val</span> <a name="VALresolve_path"></a>resolve_path : <code class="type">?base:string -> string -> string</code></pre><div class="info"> Resolves findlib notation in filename paths. The notation <code class="code"> +name/path </code> can be used to refer to the subdirectory <code class="code">name</code> of the standard library directory; the continuation <code class="code"> /path </code> is optional. The notation <code class="code"> @name/path </code> can be used to refer to the directory of the package <code class="code">name</code>; the continuation <code class="code"> /path </code> is optional. For these two notations, absolute paths are returned. <p> <br> </div> <div class="param_info"><code class="code">base</code> : When the function is applied on a relative path, the <code class="code">base</code> path is prepended. Otherwise, the path is returned as it is.</div> <pre><span class="keyword">val</span> <a name="VALlist_packages"></a>list_packages : <code class="type">?tab:int -> ?descr:bool -> Pervasives.out_channel -> unit</code></pre><div class="info"> Prints the list of available packages to the <code class="code">out_channel</code>. <p> <br> </div> <div class="param_info"><code class="code">tab</code> : The tabulator width, by default 20</div> <div class="param_info"><code class="code">descr</code> : Whether package descriptions are printed. Default: false</div> </body></html>