* [Caml-list] Garbage Collect Problem in Library
@ 2001-12-27 21:45 Warp
0 siblings, 0 replies; only message in thread
From: Warp @ 2001-12-27 21:45 UTC (permalink / raw)
To: OCaml
I got some trouble with the garbage collector.
I manage to make callbacks from my dynamic linked library, passing it
the callbackN_exn C API function address when it loads.
Now i'm doing theses things :
value caml_createwindow( value callback ) {
HWND handle_of_window = CreateWindow()
value v = alloc( 4 , MY_TAG ); // alloc is also a reference to
interpreter alloc function
Store_field( v , 0, handle_of_window ); // here we also got a "modify"
interpreter-call
Store_field( v , 1, callback_value );
SetWindowData( handle_of_window, v );
return v;
}
So , the user got the ' v ' caml value which mainly contains the real handle
of the window and the callback.
And the window itself can obtain ' v ' from handle by calling
etWindowData( handle_of_window );
in the window proc I'm getting that ' v ' data like that and then I'm
calling caml callback.
All it's fine, but after 10 seconds, the garbage collector collects my ' v '
data
( I can see that the Tag_val is set to Zero ).
How can i prevent that ?
Shall I use CAMLparamX and other garbage-living-in-harmony-stuff ?
Theses macros are using local_root so do I have to make my library ask the
current local_root from the interpreter ?
Thanks for any help !
Warp
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2001-12-27 21:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-27 21:45 [Caml-list] Garbage Collect Problem in Library Warp
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox