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: 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
 ...
 initializer
    Gc.finalise (fun _ -> delete native_pointer) self;
end;;


 Michael

-- 
GMX DSL-Flatrate 0,- Euro* - Überall, wo DSL verfügbar ist!
NEU: Jetzt bis zu 16.000 kBit/s! http://www.gmx.net/de/go/dsl