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 PAA13417; Tue, 26 Aug 2003 15:57:02 +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 PAA29904 for ; Tue, 26 Aug 2003 15:57:00 +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 h7QDuwf29912; Tue, 26 Aug 2003 15:56:58 +0200 (MET DST) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA03485; Tue, 26 Aug 2003 15:56:58 +0200 (MET DST) Date: Tue, 26 Aug 2003 15:56:58 +0200 From: Xavier Leroy To: Chris Hecker Cc: caml-list@inria.fr Subject: Re: [Caml-list] end-of-block CAMLreturn? Message-ID: <20030826155658.A10130@pauillac.inria.fr> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: ; from checker@d6.com on Thu, Aug 21, 2003 at 07:21:20PM -0400 X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 camlreturn:01 camlreturn:01 allocations:01 camllocal:01 foo:01 foo:01 callback:01 api:01 val:01 callback:01 preferable:01 camllocal:01 val:01 caml:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > Is there a way to do a CAMLreturn without the return? From looking at > memory.h it appears not, but it appears it would be easy to make a > macro to do it (#define CAMLendblock local_roots = caml__frame; or > something like that should work). > > In other words, I want to have a loop that calls back to caml, but I > don't want to keep shoving more stuff on the roots list, since I don't > care about the previous loop's allocations: > > for(i=0;i CAMLlocal(foo,bar); > // use foo bar > // callback to caml with foo bar, maybe somebody stores them somewhere > CAMLendblock(); // want this > } If I follow you correctly, there are two ways to achieve the desired behavior. One is to use the older API for GC root registration: Begin_roots and End_roots. (There is some documentation in comments in file .) for(i=0;i