Version française
Home     About     Download     Resources     Contact us    
Browse thread
memory handling with native code
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] memory handling with native code
On Thu, 2006-08-24 at 10:59 +0200, Michael Wohlwend wrote:

FYI: your email client is not correctly formatting email.
It allows paragraphs to consist of one long line. The email RFC
does not allow this. Please line break manually, around 60 characters.

My client  line-breaks your text on reading, but it does not do so in 
quotations ;(

> So I implemented a c++ widget-adapter, which inherits from widget 
> and forwards events to the ocaml widget class. 
> This works fine, but how to delete the widget adapter? 

You can use a finaliser. Look in the Gc module.
This ensures the object is not deleted whilst the Ocaml
object remains reachable. The finaliser is ordinary
Ocaml code, which can call a C routine to do the deletion.
You don't need a custom block for this, but you do need
to wrap the constructor/binder logic to ensure the
Ocaml finaliser is applied to the object.

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net