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=1.0 required=5.0 tests=AWL,SPF_FAIL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 10F6FBBE1 for ; Sat, 7 Oct 2006 17:06:27 +0200 (CEST) Received: from mail.gmx.net (mail.gmx.de [213.165.64.20]) by discorde.inria.fr (8.13.6/8.13.6) with SMTP id k97F6MxK011804 for ; Sat, 7 Oct 2006 17:06:26 +0200 Received: (qmail invoked by alias); 07 Oct 2006 15:06:19 -0000 Received: from p54A30282.dip0.t-ipconnect.de (EHLO localhost) [84.163.2.130] by mail.gmx.net (mp014) with SMTP; 07 Oct 2006 17:06:19 +0200 X-Authenticated: #20477425 Date: Sat, 7 Oct 2006 17:08:48 +0200 From: micha To: caml-list@inria.fr Subject: callback question Message-ID: <20061007170848.2cc160a2@localhost> X-Mailer: Sylpheed-Claws 2.1.1 (GTK+ 2.8.20; i486-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-Miltered: at discorde with ID 4527C26E.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; ocaml:01 ocaml:01 val:01 pointer:01 pointer:01 functions:01 caml:02 callback:02 callback:02 native:02 native:02 seems:03 finalise:04 initializer:05 manual:06 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