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.
t_repr is the concrete OCaml syntax for this module type.
univ_constr is used to constr and match_ values of type t, embedded in a value of type Univ.t.
univ_constr_repr is the concrete OCaml syntax for the field
module M : A.S defined in the library "mylib.cmxa".
module My_config_loader = Ocaml_plugin.Dynloader.Make ( struct type t = (module A.S) let t_repr = "Mylib.A.S" let univ_constr = A.univ_constr let univ_constr_repr = "Mylib.A.univ_constr" end)
univ_constr_repr should be 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 t_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 t_repr, as it is part of the complete path of the module type ("Mylib" in the example).
val univ_constr : t Dynloader.Univ_constr.t
This implementation is type safe. Some properties should be verified so that the library would work properly:
t and its representation '
t_repr' should match, -the plugin implementation doesn't override the module type sig represented by the string
t_repr: -the plugin implementation doesn't override the univ_constr scope name represented by the string
univ_constr_repr -the value
univ_constr and its representation
univ_constr_repr should match.