On 10/26/06, Hendrik Tews wrote: > > I don't quite understand: I only have pointers from C++ to ocaml. > Once constructed the ocaml objects are completely independent > from the C++ ones. > Ok, I thought they were entangled, i.e. there were pointers in both directions. But you will still need to avoid storing OCaml-values in C++-values. If you want to prevent them from being reclaimed as long as the C++-objects still refer to them, you'll have to store them in e.g. an OCaml-hashtable using e.g. integer keys as handles. Then you can store the key in the C++-object as an ordinary C++-value (i.e. no registering with the GC). If you need the OCaml-value on the C++-side, you just convert the handle to an OCaml-value, and execute a callback to look up the value associated with the handle in the hashtable. Btw., if you use an OCaml-int as handle you can store the "value" directly, because ints need not be registered with the GC anyway. Regards, Markus -- Markus Mottl http://www.ocaml.info markus.mottl@gmail.com