Module Ocaml_plugin.Compiler
val ocamlopt_opt : stringThe convention over the name of the executables inside the archive. All are native executables (.opt)
module Archive_metadata : sig ... endval embedded_files : unit -> Plugin_cache.Digest.t Core.String.Map.t Core.Or_error.tList of files in the archive embedded into the current executable.
type 'a create_arguments= (?persistent_archive_dirpath:string -> 'a) Dynloader.create_arguments
val create : (unit -> [ `this_needs_manual_cleaning_after of t ] Async.Deferred.Or_error.t) create_argumentsThis is a special utilisation of the Generic Loader. It relies on a few assumptions, such as a file called ocamlopt.opt is present in the archive, as well as some cmi files, and uses a tmp compilation_directory. A call to this function will retrieve the embedded part of the code, and extract it in the current corresponding directory. The most common use and the default value for
code_fileis`my_code. Currently this library works with native code only. Called in bytecode, this function will raise. See the documentation of dynloader for other flags, they are passed internally to that module to create the internal dynloader (in _dir, custom_warnings_spec, etc.)./!\ By using this manual create, you take the responsibility to call
clean twhen you're done with all the compilation that you want to do with this compiler. Consider usingwith_compiler,Makeorload_ocaml_src_filesif this makes your life simpler.
val with_compiler : (f:(t -> 'a Async.Deferred.Or_error.t) -> unit -> 'a Async.Deferred.Or_error.t) create_argumentsCall create, do something with the compiler, and then take care of calling clean. In case an exception or a shutdown happen and f never returns, an attempt to clean the compiler is still done via an at_shutdown execution.
val loader : t -> Dynloader.tGet the loader using this compiler and these cmi.
val clean : t -> unit Async.Deferred.Or_error.tThis will delete the temporary directory created, and remove all the files, included the files generated by the loader. This function should be used when the compiler has been created using
createfor advanced use of this module. For a simpler usage, look atwith_compileror the functor below.
module type S = sig ... endmodule Make : functor (X : Dynloader.Module_type) -> S with type t := X.tThis is a wrapper for the similar module in Dynloader that takes care of cleaning the compiler afterwards.
module Side_effect : S with type t := unitIn some cases, we are not interested by the module, but rather because it uses a side effect registering mechanism.