How to use pack(CodeWarrior)

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

  1. wannya
    OP

    wannya Member

    Newcomer
    37
    2
    Sep 17, 2007
    Switzerland
    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

    cory1492 GBAtemp Maniac

    Member
    1,497
    24
    Jun 23, 2005
    Canada
    Home, WhereElse?
    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...