package b0

  1. Overview
  2. Docs

Compiled object information.

type code =
  1. | Byte
  2. | Native

The type for code generated by the OCaml compiler. Either bytecode or native-code.

val archive_ext_of_code : code -> B00_std.Fpath.ext

archive_ext_of_code c is .cma or .cmxa according to c.

val object_ext_of_code : code -> B00_std.Fpath.ext

object_ext_of_code c is .cmo or .cmx according to c.

Compilation objects

type t

The type for compilation objects. This can represent one of a cmi, cmti, cmo, cmx, cmt, cma or cmxa file.

val file : t -> B00_std.Fpath.t

file c is the compilation object file path.

val defs : t -> Mod_ref.Set.t

defs c are the modules defined by the compilation object. If there's more than one you are looking an archive.

val deps : t -> Mod_ref.Set.t

deps c is the set of modules needed by defs c. More precisely these are the module interfaces imported by c. See also link_deps.

link_deps c is the set of modules needed to link defs c.

Note. Unclear whether this is the right data. Basically these are the module references that of deps whose name is in the required globals (bytecode) or imported implementations (native code) as reported by ocamlobjinfo. Initially we'd use deps for link dependencies but it turns out that this may break on certain install structures. It's unclear whether we need both deps and link_deps and/or if that's the correct information.

val pp : t B00_std.Fmt.t

pp formats an compilation object.

val sort : ?deps:(t -> Mod_ref.Set.t) -> t list -> t list * Mod_ref.Set.t

sort ~deps cobjs is cobjs stable sorted in dependency order according to deps (defaults to link_deps), tupled with external dependencies needed by cobjs.

val equal : t -> t -> bool

equal c0 c1 is Fpath.equal (file c0) (file c1).

val compare : t -> t -> int

compare is a total order on compilation objects compatible with equal.

module Set : Set.S with type elt = t

Compilation objects sets.

module Map : Map.S with type key = t

Compilation objectx maps.

IO

val write : B00.Memo.t -> cobjs:B00_std.Fpath.t list -> o:B00_std.Fpath.t -> unit

write m ~cobjs o writes information about the compilation cobjs to o.

read m file has the cobjs of a write to file.

val of_string : ?file:B00_std.Fpath.t -> string -> (t list, string) result

of_string ~file data parses compilation object information from data as output by Tool.ocamlobjinfo assuming it was read from file (defaults to B00_std.Os.File.dash).

OCaml

Innovation. Community. Security.