[cffi-devel] foreign-type-size of struct types

Luis Oliveira luismbo at gmail.com
Fri Aug 5 19:52:00 UTC 2005


On 5/ago/2005, at 09:02, James Bielman wrote:
>> My guess was that this had something to do with alignment of the 
>> struct, but I
>> have to admit that my knowledge about memory alignment is pretty much 
>> nil.
>> zero.
>
> Indeed this is a bug, but I probably won't have time to look at it for
> a little while...
>
> Probably foreign structure types need to sum the alignment of each
> member to calculate the total alignment of the structure (and I think
> there are some wrinkles with double float alignment on Darwin also).

Yeah, the structures are being aligned as if they were pointers. Now, I 
don't know how the structure is supposed to be aligned. I'm told that 
this depends on the ABI so I'm checking out the psABI docs. Should also 
look into what the various open-source lisps do.

If structure alignment is the same regardless of the structure type, I 
suppose we could add a new operator to CFFI-SYS to tells this, but I 
don't know if this assumption is true at all...

I have added this to my list of known issues. :-)

-- 
Luís Oliveira
http://student.dei.uc.pt/~lmoliv/
Equipa Portuguesa do Translation Project
http://www2.iro.umontreal.ca/~pinard/po/registry.cgi?team=pt




More information about the cffi-devel mailing list