From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29561 invoked by alias); 30 Mar 2010 17:02:49 -0000 Received: (qmail 29406 invoked by uid 22791); 30 Mar 2010 17:02:48 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from corp01.sj.mozilla.com (HELO mail.mozilla.com) (63.245.208.141) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 30 Mar 2010 17:02:43 +0000 Received: from mail.mozilla.com (mail.mozilla.com [10.2.72.15]) by mail.mozilla.com (Postfix) with ESMTP id 132A717FC688; Tue, 30 Mar 2010 10:02:42 -0700 (PDT) Date: Tue, 30 Mar 2010 17:02:00 -0000 From: Dan Witte To: Tom Dalling Cc: libffi-discuss@sourceware.org Message-ID: <464334663.62830.1269968561916.JavaMail.root@cm-mail03.mozilla.org> In-Reply-To: <927DA329-50EB-49DC-A9D0-C3F44FB19D01@gmail.com> Subject: Re: shallow copying in ffi_prep_cif MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact libffi-discuss-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libffi-discuss-owner@sourceware.org X-SW-Source: 2010/txt/msg00077.txt.bz2 ----- "Tom Dalling" wrote: > On 31/03/2010, at 2:31 AM, Dan Witte wrote: > > ----- "Tom Dalling" wrote: > >> Is this is the intended behaviour? I just assumed that > ffi_prep_cif > >> and ffi_prep_closure_loc would do a deep copy. > > > > Yeah, you need to keep them both alive for the lifetime of the > closure. I remember reading about this in the README, or the info > page, or something -- does it not specify? > > Thanks for your help. I had a look through the README and info pages > again, but I don't think it gets a mention. The info page actually has > an example that uses stack allocated variables, which is how I got > tripped up. Mmm, you're right. I think I figured out the lifetime bit by reading closures.c itself. If you want to write a patch to update the docs appropriately, I'm sure Anthony would take it :) Dan.