* callback question
@ 2006-10-06 9:36 Michael Wohlwend
0 siblings, 0 replies; 2+ messages in thread
From: Michael Wohlwend @ 2006-10-06 9:36 UTC (permalink / raw)
To: caml-list
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* callback question
@ 2006-10-07 15:08 micha
0 siblings, 0 replies; 2+ messages in thread
From: micha @ 2006-10-07 15:08 UTC (permalink / raw)
To: caml-list
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-10-07 15:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-06 9:36 callback question Michael Wohlwend
2006-10-07 15:08 micha
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox