Hi Ben,

Sorry to dig out this old post ...
This was about how to set up some code resources in CodeWarrior,
you said that I could have a look at DemoHack to see how to setup a .r file
to pull my code in the main application.
But I don't really see how to do that with the .r file included in DemoHack,
which is the following :

include "patc1000.tmp";
include "patc1001.tmp";

type 'tAIN' {
        align word;
        cstring;                // name
};

type 'TRAP' {
        hex integer;    // trap number
};

resource 'tAIN' (3000) {
        "It's DemoHack!"
};

resource 'TRAP' (1000) {
        0xA171
};

resource 'TRAP' (1001) {
        0xA191
};



Do I have to use the same kind of syntax to pull the code resource in my
main application ?
how do I do that ? (there's not a lot of documentation on Rez)



Renaud.


>This last step is not automatic.  Code segments defined this way don't
>get locked into memory when your application loads.  Basically, you need
>to write code like:
>
>    handle = DmGetResource('code', ID);
>    FuncPtr *fp = MemHandleLock(handle);
>    fp(args);
>    MemHandleUnlock(handle);
>
>The joy of code segments is that you don't need them to be locked all
>the time.  The disadvantage is the manual banging you need to do.  Look
>at DemoHack, see how to setup a .r file that will pull the code segment
>into your main application, then have fun.
>
>Note: unless you're doing something odd, you really don't need to do
>this -- multiple-segment applications solve most of the code size
>problems that plagued early Palm OS apps.  The KB article you're reading
>is quite a bit out of date, written before CodeWarrior had good
>multi-segment support.



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to