Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
callback question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2006-10-06 (09:36)
From: Michael Wohlwend <Michael.Wohlwend@g...>
Subject: callback question

I'm storing an ocaml object in a c++ class (the class call methods of the
ocaml objects). To do that I register the object as described for callback
functions in the manual and use it with caml_named_value.
It works perfect so it seems to be the right way. (?)
But does the gc ever remove the object (since it is registered as a callback)?

In a class definition, is this the  correct way to get things cleaned up:

class x = object
 val obj = native_pointer
    Gc.finalise (fun _ -> delete native_pointer) self;


GMX DSL-Flatrate 0,- Euro* - Überall, wo DSL verfügbar ist!
NEU: Jetzt bis zu 16.000 kBit/s!