Goswin von Brederlow wrote:

> Well, you just do. A structure is a value like anything else.

Yes, with a bit of careful debugging I managed to get a bit further
and even managed to extract (in the C code) the Ocaml function from
the Ocaml struct and I think I can call it, but I haven't test that
yet.

> What you have to watch out for is the GC.

This is what I was worried about :-).

> If you store the value
> somewhere then you have to tell the GC about it by registering it as a
> new root. And when you are done with it you need to unregister it.

Ah yes, the following two functions in <caml/memory.h>:

    CAMLextern void caml_register_global_root (value *);
    CAMLextern void caml_remove_global_root (value *);

Cheers,
Erik
-- 
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to