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.3 required=5.0 tests=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 EBB80BC50 for ; Fri, 6 Oct 2006 11:36:49 +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 k969anxu032324 for ; Fri, 6 Oct 2006 11:36:49 +0200 Received: (qmail 870 invoked by uid 0); 6 Oct 2006 09:36:36 -0000 Received: from 194.25.187.120 by www049.gmx.net with HTTP; Fri, 06 Oct 2006 11:36:36 +0200 (CEST) Content-Type: text/plain; charset="iso-8859-1" Date: Fri, 06 Oct 2006 11:36:36 +0200 From: "Michael Wohlwend" Message-ID: <20061006093636.63690@gmx.net> MIME-Version: 1.0 Subject: callback question To: caml-list@inria.fr X-Authenticated: #20477425 X-Flags: 0001 X-Mailer: WWW-Mail 6100 (Global Message Exchange) X-Priority: 3 Content-Transfer-Encoding: 8bit X-Miltered: at discorde with ID 452623B1.000 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 verfugbar:98 jetzt:98 functions:01 caml:02 callback:02 callback:02 neu:02 native:02 native:02 objects:02 I'm storing an ocaml object in a c++ class (the class call methods of the ocaml objects). 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 -- GMX DSL-Flatrate 0,- Euro* - Überall, wo DSL verfügbar ist! NEU: Jetzt bis zu 16.000 kBit/s! http://www.gmx.net/de/go/dsl