Binary serialization for OCaml