1. Dmitry Grebeniuk
  2. ocaml-cstruct-codegen

Source

ocaml-cstruct-codegen / test / test1.ml

open Cstruct_codegen

let myenum = let open Enum in
  enum "myenum" uint8_t
  [ elt "A"
  ; elt "B" ~v:3
  ; elt "C"
  ]

let () = cstruct "mystruct"
  [ uint8_t  "ui8"
  ; int64_t "si64" ~dump_fmt:"0x%LX"
  ; myenum  "en"
  ]

let () = codegen "/tmp/qwq.ml"