input/output_value are using Marshal under the hood, so it's going to be the same.

However, be aware that marshall (and the _value functions) are quite unsafe. If you have an error in the data (or your change the representation in OCaml), you will have ... surprising errors (including segfaults).

There are plenty of safer solutions for serialization (deriving, sexp, yojson, to name a few).

Le 02/02/2015 17:05, Dhek Uir a écrit :


On Mon, Feb 2, 2015 at 4:43 PM, Jacques-Henri Jourdan <jacques-henri.jourdan@inria.fr> wrote:
Le 02/02/2015 16:39, Dhek Uir a écrit :
> I'm looking for a compression library such as camlzip to read/write
> compressed files (any lossless compression algorithm is fine), but
> having a function similar to Pervasives.output_value, which does not
> seem to be available in camlzip (and I do not see how I could easily
> implement it).
>
> Would it be simple to modify camlzip to add this function? I believe
> that if this were the case, then it would already have been done, but
> I might be wrong.
>
> Otherwise, is there another OCaml library with an API very similar to
> Pervasives'? I'd prefer a lightweight solution (avoiding Core and
> Batteries) if possible.

Can't you do Marshal.to_string, and then use Camlzip on the generated
string ?

 
Indeed, I can. I believe the hard part is actually the input_value operation.
But I haven't looked enough into Marshal, maybe my solution can be found there.