Previous Up Next

5.9  Module Fmarshal

Marshaling of data structures.

This module provides functions to encode arbitrary data structures as sequences of bytes, which can then be written on a file or sent over a pipe or network connection. The bytes can then be read back later, possibly in another process, and decoded back into a data structure. The format for the byte sequences is compatible across all machines for a given version of Objective Caml.

val to_string : 'a -> 'b string
                with content('a) < 'b
Fmarshal.to_string v flags returns a string containing the representation of v as a sequence of bytes.

val from_string : 'a string -> 'b
                  with 'a < level('b)
Fmarshal.from_string buff ofs unmarshals a structured value stored in stg.

Previous Up Next