From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 12785BB83 for ; Thu, 24 Aug 2006 17:46:42 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k7OFkfG3026907 for ; Thu, 24 Aug 2006 17:46:41 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id RAA28185 for ; Thu, 24 Aug 2006 17:46:40 +0200 (MET DST) Received: from ash25e.internode.on.net (ash25e.internode.on.net [203.16.214.182]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k7OFkcPF026877 for ; Thu, 24 Aug 2006 17:46:40 +0200 Received: from rosella (ppp14-47.lns2.syd7.internode.on.net [59.167.14.47]) by ash25e.internode.on.net (8.13.6/8.13.5) with ESMTP id k7OFkPGL084239; Fri, 25 Aug 2006 01:16:27 +0930 (CST) (envelope-from skaller@users.sourceforge.net) Subject: Re: [Caml-list] memory handling with native code From: skaller To: Michael Wohlwend Cc: caml-list@inria.fr In-Reply-To: <20060824085934.198440@gmx.net> References: <20060824085934.198440@gmx.net> Content-Type: text/plain Date: Fri, 25 Aug 2006 01:46:25 +1000 Message-Id: <1156434385.20759.24.camel@rosella.wigram> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 44EDC9E1.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 44EDC9DE.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; widget:01 ocaml:01 widget:01 ocaml:01 2006:98 sourceforge:01 wrote:01 caml-list:01 constructor:01 implemented:02 native:02 fyi:02 quotations:03 module:03 inherits:03 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 Felix, successor to C++: http://felix.sf.net