> After playing around with this for a little while (getting it to work
> under Win32) it definitely seems to be the better approach. It
> eliminates
> Pila from the mix, which is a plus when all the code is in C anyway.
> Pila usually creates two dummy code resources with id's 0 and 1, at 8
> bytes apiece, so that's just wasted space. Compiling and gluing with
> GCC only
> results in a smaller PRC, too.
i believe it is the other way around :> gcc adds '0x0001' just before
the 'start()' routine.
if you want a small startup code (as long as your program uses no
globals etc) - good for hacks.. try this code:
---
register ULong reg_a4 asm("%a4");
ULong start()
{
ULong result = -1;
ULong save_a4;
SysAppInfoPtr appInfo;
Ptr prevGlobals;
Ptr globalsPtr;
save_a4 = reg_a4;
if (SysAppStartup (&appInfo, &prevGlobals, &globalsPtr) != 0) {
SndPlaySystemSound (sndError);
}
else {
reg_a4 = 0;
result = PilotMain(appInfo->cmd, appInfo->cmdPBP,appInfo->launchFlags);
SysAppExit (appInfo, prevGlobals, globalsPtr);
}
reg_a4 = save_a4;
return result;
}
---
it is taken from the crt0.c file which you can get with prc-tools 0.5.0
i stripped all the relocation stuff (as i dont need globals).
code works fine for me.. looks like i used pila in gcc :>
when you compile.. you need to do the following:
---
gcc -nostartfiles crt0.o ....
---
crt0.o MUST be first.. thats just the rules :> i used this technique
to reduce the size of an application launcher i used.
this will make your code smaller.. :> by around 50%
az.
--
Aaron Ardiri
Lecturer http://www.hig.se/~ardiri/
University-College i G�vle mailto:[EMAIL PROTECTED]
SE 801 76 G�vle SWEDEN
Tel: +46 26 64 87 38 Fax: +46 26 64 87 88
Mob: +46 70 352 8192 A/H: +46 26 10 16 11