This is the mail archive of the 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: Cosure return value issue on Linux PPC64

Kaz> Is this documented somewhere?

A while back I tried to document all these little oddities in the
manual.  It's difficult and ABI-breaking to fix libffi to be more in
line with user expectation, but at least in the meantime the docs can be

The closure docs say:

    @item ret
    Otherwise, @var{fun} must fill the object to which this points,
    following the same special promotion behavior as @code{ffi_call}.
    That is, in most cases, @var{ret} points to an object of exactly the
    size of the type specified when @var{cif} was constructed.  However,
    integral types narrower than the system register size are widened.  In
    these cases your program may assume that @var{ret} points to an
    @code{ffi_arg} object.

I hope this helps, but if it's still insufficiently clear, I'd
appreciate suggestions for how to improve it.

>From your other note:

Kaz> I'm not a complete idiot; I was taken for a ride by the simple
Kaz> example from some (perhaps outdated?) libffi texinfo
Kaz> documentation. This one:

You're definitely not an idiot, this has bitten many people, has been
asked on StackOverflow, has been filed as a bug in github a few times,

Alan Modra fixed up this documentation example back in 2013, according
to git blame.  Seems like libffi is overdue for a release :-)

Anyway, I think the in-tree docs should be a bit clearer here.  For
example they mention the promotion behavior now.


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