Browse thread
[Caml-list] Garbage Collect Problem in Library
- Warp
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Warp <warplayer@f...> |
| Subject: | [Caml-list] Garbage Collect Problem in Library |
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