This is the mail archive of the libffi-discuss@sourceware.org mailing list for the libffi project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: shallow copying in ffi_prep_cif


----- "Tom Dalling" <tom.dalling@gmail.com> wrote:

> 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.

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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]