This is the mail archive of the
libffi-discuss@sourceware.org
mailing list for the libffi project.
Re: shallow copying in ffi_prep_cif
On 31/03/2010, at 2:31 AM, Dan Witte wrote:
> ----- "Tom Dalling" <tom.dalling@gmail.com> 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.
--Tom