The type t
is the type of a first level module you want to load.
This is typically the type of your expected config file, as a top level
ocaml module.
The field repr
is the concrete OCaml syntax for this module type.
The field univ_constr
is used to constr and match_ values of type t, embedded
in a value of type Univ.t.
The field univ_constr_repr
is the concrete OCaml syntax for the field univ_constr
.
Example : TODO: CUSTOM defined in the library "mylib.cmxa".
module My_config_loader = Ocaml_plugin.Ocaml_dynloader.Make (
struct
type t = (module A.S)
let repr = "Mylib.A.S"
let univ_constr = A.univ_constr
let univ_constr_repr = "Mylib.A.univ_constr"
end)
repr
and univ_constr_repr
should be contain complete paths, as it would be
used by an ocaml file to link with the shared cmi files, in particular be aware
that if you have some 'open' statements in your file, you might have different
t and repr, which is a bad practice.
If the module type A.M_intf
is defined in a package, you would need
to add it in the repr, as it is part of the complete path of the module type
("Mylib" in the example).