Updated for OCaml 4.12.0
  • OCaml 98.1%
  • Makefile 1.9%
Find a file
2021-09-23 11:31:05 +02:00
src Added bytecode version 026 2021-09-06 15:57:55 +02:00
.gitignore Fix 4.04 compatibility. 2017-04-12 01:34:59 +02:00
configure Fix compatibility with new bytecode version V023. Fix compatibility with ocaml-4.07. Fix interpretation of external calls. 2019-03-07 17:40:02 +01:00
INSTALL Fix 4.04 compatibility. 2017-04-12 01:34:59 +02:00
LICENSE-en First commit 2014-04-04 00:15:38 +02:00
LICENSE-fr First commit 2014-04-04 00:15:38 +02:00
Makefile Fix compatibility with new bytecode version V023. Fix compatibility with ocaml-4.07. Fix interpretation of external calls. 2019-03-07 17:40:02 +01:00
META Actually install the meta file 2018-01-27 02:04:09 -08:00
opam Added opam file 2021-09-16 11:41:22 +02:00
README.md Update README.md 2021-09-23 11:31:05 +02:00
VERSION Switch version to 1.5. 2019-03-07 17:41:02 +01:00

OByteLib

OCaml bytecode library tools. Useful to read, write and evaluate OCaml bytecode files.

Warning

I simply told obytelib to accept 4.12.0 OCaml bytecode files. While it seems to work I can provide no guarantees that it actually does.

Example

open OByteLib

let usage () =
  Printf.eprintf "Usage: %s <input.byte>\n" Sys.argv.(0);
  exit 1
    
let inpath =
  match Sys.argv with
  | [| _; inpath |] -> inpath
  | _ -> usage ()
  
let () =
  match Filename.extension inpath with
  | ".byte" ->
    let bytefile = Bytefile.read inpath in (* Load the given bytecode file *)
    Bytefile.print stdout bytefile;        (* Pretty-print its contents    *)
    Interp.eval_bytefile bytefile;         (* Evaluate its code            *)
  | ".cmo" ->
    let cmofile = Cmofile.read inpath in   (* Load the given .cmo file     *)
    Cmofile.print stdout cmofile           (* Pretty-print its contents    *)
  | _ ->
    usage ()