How to use pack(CodeWarrior)

Discussion in 'NDS - ROM Hacking and Translations' started by wannya, Feb 4, 2009.

Feb 4, 2009

How to use pack(CodeWarrior) by wannya at 3:07 AM (1,900 Views / 0 Likes) 1 replies

  1. wannya
    OP

    Newcomer wannya Member

    Joined:
    Sep 17, 2007
    Messages:
    37
    Country:
    China
    Google(Very Sorry)

    Metrowerks CodeWarrior for Nintendo DS

    How to use pre-compiled instruction pack

    __attribute__ ((packed))
    # pragma pack (1)
    # pragma options align = packed
    Have failed
     
  2. cory1492

    Member cory1492 GBAtemp Maniac

    Joined:
    Jun 23, 2005
    Messages:
    1,489
    Location:
    Home, WhereElse?
    Country:
    Canada
    Examples for porting PC to codewarrior are...
    Code:
    #pragma options align=packed
    typedef struct
    {
    ÂÂÂÂchar foo;
    ÂÂÂÂshort bar;
    } foobar;
    #pragma options align=reset
    Code:
    #pragma pack(push, 1)
    typedef struct
    {
    ÂÂÂÂchar foo;
    ÂÂÂÂshort bar;
    } foobar;
    #pragma pack(pop)
    This is for struct alignment in memory only. Not the same as GCC "__attribute__ ((packed))" when using sizeof() which as far as I can tell has no equal in codewarrior compilers.

    Search your local headers for the toolchain to see if there are any "pack" used? I've never seen the DS official versions myself. Hope that helps...
     

Share This Page