| 1 | (************************************************************************) |
| 2 | (* * The Rocq Prover / The Rocq Development Team *) |
| 3 | (* v * Copyright INRIA, CNRS and contributors *) |
| 4 | (* <O___,, * (see version control and CREDITS file for authors & dates) *) |
| 5 | (* \VV/ **************************************************************) |
| 6 | (* // * This file is distributed under the terms of the *) |
| 7 | (* * GNU Lesser General Public License Version 2.1 *) |
| 8 | (* * (see LICENSE file for the text of the license) *) |
| 9 | (************************************************************************) |
| 10 | |
| 11 | (** This file provides facilities to access OCaml compiler and dynamic linker, |
| 12 | used by the native compiler. *) |
| 13 | |
| 14 | (* Directory where compiled files are stored *) |
| 15 | val output_dir : CUnix.physical_path ref |
| 16 | val include_dirs : CUnix.physical_path list ref |
| 17 | |
| 18 | (** Default value for include dirs in non -boot mode (just the kernel). *) |
| 19 | val default_include_dirs : Boot.Env.t -> CUnix.physical_path list |
| 20 | |
| 21 | val get_load_paths : (unit -> string list) ref |
| 22 | |
| 23 | val load_obj : (string -> unit) ref |
| 24 | |
| 25 | val get_ml_filename : unit -> string * string |
| 26 | |
| 27 | (** [compile file code ~profile] will compile native [code] to [file], |
| 28 | and return the name of the object file; this name depends on |
| 29 | whether are in byte mode or not; file is expected to be .ml file *) |
| 30 | val compile : string -> Nativecode.global list -> profile:bool -> string |
| 31 | |
| 32 | type native_library = Nativecode.global list * Nativevalues.symbols |
| 33 | |
| 34 | (** [compile_library (code, _) file] is similar to [compile file code] |
| 35 | but will perform some extra tweaks to handle [code] as a Rocq lib. *) |
| 36 | val compile_library : native_library -> string -> unit |
| 37 | |
| 38 | (** [execute_library file upds] dynamically loads library [file], |
| 39 | updates the library locations [upds], and returns the values stored |
| 40 | in [rt1] and [rt2] *) |
| 41 | val execute_library : |
| 42 | prefix:string -> string -> Nativevalues.symbols -> Nativecode.code_location_updates -> |
| 43 | Nativevalues.t option * Nativevalues.t option |
| 44 | |
| 45 | (** [enable_library] marks the given library for dynamic loading |
| 46 | the next time [link_libraries] is called. *) |
| 47 | val enable_library : string -> Names.DirPath.t -> unit |
| 48 | |
| 49 | val link_libraries : unit -> unit |
| 50 | |
| 51 | (* used for communication with the loaded libraries *) |
| 52 | val get_symbols : unit -> Nativevalues.symbols |
| 53 | val rt1 : Nativevalues.t option ref |
| 54 | val rt2 : Nativevalues.t option ref |