Before I go
off on a wild goose chase...
Did you have to recompile the CodeWarrior runtime libraries to expose
__LoadAndRelocate__()? It's declared static in PalmOS_Startup.cpp, so
I can't link to it.
Or am I missing something?
Thanks for your help,
Gary
Neil Whitworth wrote:
Which version of CW do you have.
We have done this successfully with CW 9.3.
__LoadAndRelocate__() should not access globas.
Our start up code looks like this:-
_CW_SetupExpandedMode ( );
if ( !(launchFlags & sysAppLaunchFlagNewGlobals) )
{
SysAppInfoType *appInfoP = NULL;
SysAppInfoType *rootAppInfoP = NULL;
appInfoP = SysGetAppInfo(&rootAppInfoP, &appInfoP);
/* Relocate multi-segment applications */
MTWK::__LoadAndRelocate__(true, appInfoP->codeH);
}
Ralf Dietrich wrote:
I have also tried the suggested way:
a) Patch "PalmOS_Startup.cpp" from runtime to remove "static" from
__LoadAndRelocate__() and export __LoadAndRelocate__() in CWPalmOS.h
Recompile CWs "Palm OS Runtime".
Is there a easier way to get access to __LoadAndRelocate__() ?
b) Call __LoadAndRelocate__() in a single-segment-situation (e.g.
sysAppLaunchCmdNotify):
SysAppInfoType *appInfoP = NULL;
SysAppInfoType *rootAppInfoP = NULL;
appInfoP = SysGetAppInfo(&rootAppInfoP, &appInfoP);
MTWK::__LoadAndRelocate__(true, appInfoP->codeH); // load segments
AcceesFunctionFromSecondSegement(); // <- crashes!
MTWK::__LoadAndRelocate__(false, appInfoP->codeH); // unload
segments
Any function call to segment two crashes. Anyone can outline this?
Note: The Emulator report accese to globals in __LoadAndRelocate__()
Enviroment:
CW 9.3 Pro
Neil Whitworth wrote:
Gary wrote:
Thanks very much Neil. I don't actually
need globals, so assuming this works I should be all set to go!
Thanks,
Gary
Its a trick we use in all our apps. I'd recommend reading the code in
the runtime library, as there are some situations when you don't need
to call it as the runtime does itself (normal launch being one), and
you should only ever call it once. Calling it a second time will cause
problems as the inter-segment jump tables get corrupted. (We have some
re-entrant launch codes that caused problems)
--
For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
|
- Re: Multi segment background application Gary
-