I'm pleased to announce the first release of capnp-ocaml:
https://github.com/pelzlpj/capnp-ocaml

Cap'n Proto is a multi-language serialization framework which uses code generation techniques in a manner similar to Protocol Buffers. Its distinguishing feature is that there is no explicit parsing/serialization step: the on-the-wire message format is also designed to serve as an efficient in-memory data structure representation.

The capnp-ocaml code generator plugin emits pure OCaml code which is functorized over the underlying message format. At present, a 'bytes'-based message format is provided for ease of use with file and socket I/O. In the future, a Bigarray message format could be easily provided; this would lend itself to a straightforward method for sending and receiving messages via an mmap'd shared memory region.

Q: Why would I want to use this over sexplib/bin-prot?
A: These projects provide superior language-level integration, but capnp-ocaml is a better choice if you care about language portability.

Q: Why would I want to use this over Protocol Buffers?
A: Cap'n Proto has the clear advantage of first-class sum types, which are mapped to OCaml variants in a straightforward fashion. You also find yourself intrigued by the potential for better performance and zero-overhead shared-memory message passing.

capnp-ocaml is available on OPAM as package "capnp".

Paul