This is the mail archive of the
libffi-discuss@sourceware.org
mailing list for the libffi project.
Re: does it matter how I construct an aggregate struct type if its size is the same?
- From: Jay <jay dot krell at cornell dot edu>
- To: Andrew Haley <aph at redhat dot com>
- Cc: Hayden Livingston <halivingston at gmail dot com>, "libffi-discuss at sourceware dot org" <libffi-discuss at sourceware dot org>
- Date: Fri, 18 Dec 2015 13:42:44 -0800
- Subject: Re: does it matter how I construct an aggregate struct type if its size is the same?
- Authentication-results: sourceware.org; auth=none
- References: <CAMxMwy+ATViiyo4Znn4-jhmoKNEDWbHUxFPOmK6sX9_Lxd_j0w at mail dot gmail dot com> <5673E92C dot 7090400 at redhat dot com> <CAMxMwyJq-FH9gwvtJ3-AOnHoDUfdY2Oj8E2pSeNpHj42Wdif0g at mail dot gmail dot com> <567466D0 dot 5020305 at redhat dot com>
Still beware of alignment.
- Jay
On Dec 18, 2015, at 12:04 PM, Andrew Haley <aph@redhat.com> wrote:
> On 18/12/15 15:16, Hayden Livingston wrote:
>> Thanks, Andrew. Where is this exception? In ABIs?
>>
>> So you're suggesting I use char's to construct my ffi_types?
>
> Well, it can be awkward. Some targets pass the components of a
> struct in registers. But this only matters if you pass a struct
> by value, which is a fairly unusual thing to do in C. If you're
> passing a struct by reference, then yes, you can just create a
> char array of the right size.
>
> Andrew.
>