package omod
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha512=cab9e8ab6ca6e836fdaa3dcf9552d31e4de2bf069fcab096c1565d204ff91fc3516cd017a13702d749580bd3563c462db3277ab036cfc5d3cb9703a08ddbb927
doc/omod/Omod/index.html
Module Omod
Load installed modules in the toplevel.
See the tutorial.
Omod
The type for specifying silence. See load
.
val load :
?batch:bool ->
?silent:silent ->
?force:bool ->
?incs:bool ->
?init:bool ->
?dir:fpath ->
string ->
bool
load ~batch ~silent ~force ~deps ~incs ~init ~dir "M"
loads module M
and returns true
if the load was successful; init files may however have failed to load. The exact side effects of this function are described here. The optional parameters are as follows:
batch
iftrue
alternative load sequences error rather than interactively ask to select one. Defaults tonot !
Sys.interactive
.silent
if`All
nothing is logged except errors. If`Loads
then load sequences are not logged but other diagnostic messages may be logged. If`No
both load sequences and diagnostic messages are logged. Defaults to`No
.force
iftrue
force the reload of objects. Defaults tofalse
.incs
iftrue
directory includes should be added. Defaults totrue
. See load semantics for details.init
iftrue
toplevel init files should be loaded, see the load semantics. Defaults totrue
.dir
is currently ignored.
The full syntax for specifying the module to load is:
[PKG.]M(@VARIANT)*
M
is always the top level (compilation unit) module name to load.PKG
constrainsM
to be found in packagePKG
. Packages names are the name of directories just below omod's library directory (seeomod conf
, andomod pkg
for a list).@VARIANT
(repeatable) indicates that all ambiguities should be resolved according to variantVARIANT
. This means that if an object can be found in multiple directories in a package directoryP
, the one that is rooted in the hierarchy starting atP/VARIANT
orP/@VARIANT
will be selected. If no ambiguity arises the parameter is ignored. See the tutorial for an example.
val loads :
?batch:bool ->
?silent:silent ->
?force:bool ->
?incs:bool ->
?init:bool ->
?dir:fpath ->
string list ->
bool
loads
is like load
but for a list of module specifications. Note that specified variants apply to all of the modules.
Assuming loads
This following can be used to assume that certain loads are already performed to prevent them from being (re)loaded by load
invocations.
val assume_load :
?batch:bool ->
?silent:silent ->
?force:bool ->
?incs:bool ->
?init:bool ->
?dir:fpath ->
string ->
bool
assume_load
is like load
but assumes the corresponding load sequence was already performed.
val assume_loads :
?batch:bool ->
?silent:silent ->
?force:bool ->
?incs:bool ->
?init:bool ->
?dir:fpath ->
string list ->
bool
assume_loads
is like loads
but assumes the corresponding load sequence was already performed.
val assume_inc : fpath -> unit
assume_inc dir
assumes that path dir
has been included.
val assume_obj : fpath -> unit
assume_obj obj
assumes that file path obj
has been loaded.
module Private : sig ... end
Private definitions.
Load semantics and effects
- Loading an object means: load its dependencies, add its containing directory to the included directories (if
incs
istrue
), load the actual object and finally load its toplevel init file (ifinit
istrue
and the file exists, see below). - The toplevel init file of an object with basename
o
is a file calledo_top_init.ml
in the same directory as the object. - If an object is available both as a standalone file (
cmo
,cmx
) and in a library archive (cma
,cmxs
),Omod
favours loading the library archive. - If an interface dependency cannot be resolved to an implementation but does resolve to a compiled interface, the dependency is assumed to be a mli-only compilation unit and the directory of the compiled interface is added to the includes (if
incs
is true). The initialization performed by
omod.top
andomod.nattop
assume (withincs:false
andinit:false
) the following modules:utop.UTop
ifomod.top
is#use
d inutop
.ocaml.Toploop
ifomod.top
is#use
d (not inutop
).ocaml.Opttoploop
ifomod.nattop
is#use
d. .
- Load sequences with
vmthread
variants and objects of the formm.p.ext
(profiling versions in the stdlib) are excluded from load sequence results. This reduces the load sequence from multiple occurrences to a single candidate on many modules. - For
ocamlnat
dependency analysis is made oncmx
andcmxa
files, the suffixes of resulting objects is then mapped tocmxs
. This assumes the corresponding files exist and their objects match.