From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA24535; Fri, 26 Apr 2002 10:22:15 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id KAA24751 for ; Fri, 26 Apr 2002 10:22:14 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g3Q8Kwf05465; Fri, 26 Apr 2002 10:20:58 +0200 (MET DST) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA24815; Fri, 26 Apr 2002 10:20:58 +0200 (MET DST) Date: Fri, 26 Apr 2002 10:20:58 +0200 From: Xavier Leroy To: Jakob Lichtenberg Cc: caml-list@inria.fr Subject: Re: [Caml-list] camlidl - finalizing cows without COM! Message-ID: <20020426102058.B24598@pauillac.inria.fr> References: <000901c1e5c1$f47cc130$5ba4389d@redmond.corp.microsoft.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <000901c1e5c1$f47cc130$5ba4389d@redmond.corp.microsoft.com>; from jl@itu.dk on Tue, Apr 16, 2002 at 08:42:53PM -0700 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > Hi, > > I have just started hacking in camlidl and for now had a really pleasant > experience. > > However I really can't find out how to create a finalized object without > going into COM interfaces. > > Say my underlying C library for manipulating ..... hmmm.. cows has a > function that creates and references a new cow, and a function that is used > to de-reference the cows when they no longer are live: > > typedef int cow; > cow createAndReferenceCow(void); > void freeCow(cow); > > Now, when the OCaml structures for some reason decide to garbage collect my > cow the finalized object should call freeCow...... I have done this a bunch > of times without the idl interface, but have no clue how to specify this in > an idl file. Help!!! There's a new release of CamlIDL at http://caml.inria.fr/camlidl/ that supports a "finalize" attribute to do just this, e.g. typedef [abstract,finalize(freeCow)] int cow; The release also fixes some minor bugs with error reporting in presence of import files, and with "const" qualifiers. (Thanks for Dmitry Bely for his extensive testing and bug hunting!) - Xavier Leroy ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners