Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: #pragma pack?



This should do the trick with no struct changes:

#if defined(__GNUC__)
    #define _BytePacked_    __attribute__ ((packed))
    #define Packed_Struct    struct _BytePacked_
#else
    #define _BytePacked_
    #define Packed_Struct    struct
#endif

#pragma pack(push)
#pragma pack(1)
typedef Packed_Struct arawana_usb_cmd
{
    unsigned char    tmpbuf[8];
} tmpstruct;
#pragma pack(pop)

Dave

on 3/8/02 9:59 AM, David Ferguson at email@hidden wrote:

> Have you considered rewriting this as:
> 
> typedef struct arawana_usb_cmd {
> unsigned char    tmpbuf[8];
> } tmpstruct;
> 
> That way it will be independent of the compiler used.
> 
> If that is not possible/acceptable, then you need to look in your
> compiler documentation for the answer (or at least tell us what
> compiler/development system you are using).
> 
> David Ferguson
> USB Software Team
> Apple Computer, Inc.
> 
> 
> At 3:38 PM +0800 3/8/02, email@hidden wrote:
>> Hello,
>> In windows, I used this for aligned 1bytes in linux driver?
>> How can I do this in MAC OS X?
>> 
>> #pragma pack(push)
>> #pragma pack(1)
>> typedef struct arawana_usb_cmd {
>> unsigned char    tmp1[7];
>> unsigned char    tmp2;
>> } tmpstruct;
>> #pragma pack(pop)
>> 
>> 
>> PLS SHOW ME WHICH IS THE MACRO IN MAC?
>> 
>> Thanks in advance,
>> Jari
>> _______________________________________________
>> usb mailing list | email@hidden
>> Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/usb
>> Do not post admin requests to the list. They will be ignored.
_______________________________________________
usb mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/usb
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: #pragma pack? (From: David Ferguson <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.