Thanks Quincey, it set me on the right track,

I used #pragma pack(4) for these structures (with relevant push and pops so 
it's isolated to this case only) and it all started working fine.

Is using the syntax you suggested considered better form than #pragma,?


--Graham




On 07/05/2012, at 4:30 PM, Quincey Morris wrote:

> On May 6, 2012, at 22:51 , Graham Cox wrote:
> 
>> Could this be caused by the 64 bit compiler padding out my structures in a 
>> different way for 64-bit builds?
> 
> Yes, I believe in 64-bit builds 8-byte data types are 8-byte aligned, while 
> they're only 4-bit aligned in 32-bit builds -- or something like that.
> 
>> If so is there a way to tell it not to for these types?
> 
> Try this:
> 
>       typedef struct {
>               ...
>       } __attribute__ ((packed)) MyStruct;
> 
> 

_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to