This is the mail archive of the
libffi-discuss@sourceware.org
mailing list for the libffi project.
Re: return value buffer malloc()'ed vs alloca()'ed
- From: Andrew Haley <aph at redhat dot com>
- To: Anthony Green <green at moxielogic dot com>
- Cc: Igor Bogomazov <ygrex at ygrex dot ru>, "libffi-discuss at sourceware dot org" <libffi-discuss at sourceware dot org>
- Date: Tue, 08 Oct 2013 18:36:10 +0100
- Subject: Re: return value buffer malloc()'ed vs alloca()'ed
- Authentication-results: sourceware.org; auth=none
- References: <20131008101354 dot 43baeeeb at ygrex-mac> <CACxje58LTEpBiaUHQn6Bp=Puvmz-Sg7gReGrWfz2Nz-diZG4GA at mail dot gmail dot com>
On 10/08/2013 06:30 PM, Anthony Green wrote:
> The result
> buffer needs to be the largest native integral type on your system.
> Use a 64 bit long for rc instead of mallocing the exact return type
> size. You can pass it into ffi_call as &rc and simply cast it to an
> int at the end. I just checked the docs and it's definitely not
> clear
Hmmmmm. It's not so much unclear as completely wrong.
Andrew.