Automatically build and dynlink OCaml source files
Parameter #1 Ocaml_plugin . Compiler . Make . X
type t

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 t_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 : module M : A.S defined in the library "mylib.cmxa".

module My_config_loader = Ocaml_plugin.Dynloader.Make (
  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"

t_repr and 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 t_repr : string
val univ_constr : t Dynloader.Univ_constr.t
val univ_constr_repr : string

This implementation is type safe. Some properties should be verified so that the library would work properly:

-the type 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.