James,

Here's a snippet from the CW for Palm Computing platform FAQ:

7.2 When building my application the linker reports "16-bit reference out of
range." How do I fix this? (Typically this occurs to users who have had a
large application working for some time and have just added "a little more
code" to the application.)

Due to limitations in the Palm OS, applications cannot make jumps of more
than 32K (usually called "near" or "small" model on 68K series processors).
The error message indicates that someplace in your code you are calling a
function in another block of code that is more than 32K away in the compiled
application. Since the jump is further than the Palm OS allows, the linker
cannot resolve the reference. Here are ways to work around the limitation:

Change the link order of the application
The linker error message will tell you what function in your code was
calling for the function which was too far away. You can determine what
source file the calling and called functions are in and move the source
files closer together in the link order (place the files closer together in
the Segments view of the project, under the Segments tab of the project
window). In many cases a little reorganization of the link order can solve
the problem. However, as you continue to write code for the app and its gets
larger eventually it may not be possible to reorganize the source file link
order to eliminate the problem.

Set the compiler to "Smart" code model
Set the Code Model popup menu of the 68K processor preference panel (in the
Target settings window) to "Smart." This will allow the compiler to resolve
the out of range references itself. There is a size penalty associated with
this, for more info see the explanation of code models in "What does the
Code Model popup do?" below.

Reorganize/Rewrite your code itself
Palm makes several suggestions on how to write your application to avoid
these issues by using jump islands or jump tables. For information see the
following document from Palm http://www.palm.com/devzone/tn_32kj.html.

Rgds,
JK Lam
Metrowerks Technical Support

----- Original Message -----
From: James <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 19, 1999 11:41 AM
Subject: Codewarrior link error


> I'm sure that this question has been asked and answered before, but it's
> the first time I've seen this....
>
> Attempting to compile, link and run a program under CodeWarrior IDE 2.1, I
> get the following message when it treis to link:
>
> Link Error   : PM8500 Internal:PalmOS Apps Development:E6-B
> 0.1x:Src:E6-B.c: 'SetEventHandler' 16-bit code reference to
> 'AirspeedHandleEvent' is out of range.
>
> Simply commenting out one function call in the source code (one which has
> nothing to do with either  SetEventHandler or AirspeedHandleEvent) makes
> the error go away.
>
> Does anyone know what this error message means, and how to avoid it?
>
> - James Einolf
> Little Wing Software Development
>
>
>

Reply via email to