Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: micha <micha-1@f...>
Subject: callback question
I'm storing an ocaml object in a c++ class (the class calls methods of
the ocaml class). 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
 ...
 initializer
    Gc.finalise (fun _ -> delete native_pointer) self;
end;;


 Michael