Joe Fant writes:
> My problem that I have is that there seem to be several functions 
> that simply blow up when I put them in any of the extra sections.  
> They seem to work fine in the base code section, but are never reached 
> when I put them in an extra section.  Sometimes the code behaves as if 
> the desired function is never called and sometimes it behaves as if I 
> made a random jump into some other random code.  Even if the calling 
> code is in extra section 2, I can't call an offending function if I 
> locate it in extra section 2, but it works fine if it is located in 
> the base code section.  For example...
> extern void AppCopyTextToField(FormType *pForm, UInt16 uwFieldID, 
>     char *pNewText, Boolean fDrawNow);//    EXTRA_SECTION_TWO;
> This was a routine that was in J.B. Parrett's AppUtilities.c file 
> from the Palm Garnett class that I recently took.  This works fine 
> if I include the ";//" so that the function is located in the base 
> code section.  It fails if I remove the ";//" and the function is 
> located in extra section two.

Make sure that you have no place in your code where AppCopyTextToField() 
is called without a prototype in scope that includes the section tag. 
If there's a callsite that isn't covered by a prototype, the compiler 
assumes the function is in the caller's segment (or maybe in the main 
section, I forget which). In that case, the code generated at the 
callsite will be wrong, and will jump to some random place.

Also make sure that the definition of AppCopyTextToField() is itself 
within the scope of the prototype that specifies the section tag. 
If the callsites are covered by that prototype but the definition 
is not, then the callsites will jump to section 2 but the function 
itself will be in section 1.

gcc warnings can point out some of the potentially incorrect callsites 
and definitions:
-Wimplicit-function-declaration
-Wmissing-prototypes
-Wmissing-declarations


-- 
Greg Parker     [EMAIL PROTECTED]
pssh: SSH 2 for Palm OS 5     http://www.sealiesoftware.com/pssh/
Peal: Palm ELF ARM Loader     http://www.sealiesoftware.com/peal/


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

Reply via email to