On 3/13/06, "Sayan (Sébastien Li-Thiao-Té)" <sayan@crans.org> wrote:
I am trying to learn how to allocate a list in C and pass the result to
Caml on an opteron Debian box. Here is the function that I use :

Your function does not protect "str" from being reclaimed by the GC (which can happen in "caml_alloc_small"), and you should use the Field-macro only to overwrite the contents of the cons-block in this particular case, because you had used "caml_alloc_small" as allocation function, and there was no intermediate allocation.

Regards,
Markus

--
Markus Mottl        http://www.ocaml.info        markus.mottl@gmail.com