Adam Dingle wrote:
> Project Type = Library, and the PalmOS Library button is set.  This 
> library contains more than 64K of executable code, so I created a 
> number of segments in the foo.mcp project and partitioned the object 
> files among them so that each segment is at most 64K in size.

That has no effect when building a static library, because a library
isn't an executable (.prc) with code resources.  It's basically just a
bunch of compiled functions clumped together, with no size limit.  None
of this 64K limit stuff happens until you later build the final .prc,
when the linker tries to put everything together.

(The docs and the IDE don't exactly make this obvious.)

> So far, so good.  I'm able to build foo.lib with no problem.

Right.  No size limit when building a static library.

> I added "foo.lib" to the "app.mcp" project and built the project.  
> Unfortunately, CodeWarrior seems to insist on placing all
> the object code from foo.lib into a single segment in app.prc

Right.  When building a .prc, the linker does what you say in the
Segments window, on a file-by-file basis.  And since foo.lib is a single
file, the linker dutifully puts all its functions in one segment.  (Only
the functions you actually call, that is.)

> so I now have a .prc file which won't load because one of its 
> segments is larger than 64K.

Not helped by the fact the linker doesn't warn you about this.

> is it just not possible to link in a library which has
> more than 64K of code?

Almost; technically the linker omits functions which never get called,
so the library can have way more than 64K of code as long as the
functions you actually call don't add up to more than 64K.  But it
sounds like you're over 64K either way in this case.

> Thanks in advance for any advice.

First, why are you building this external library instead of putting all
files in the .prc project?  If it's convenient, just put all source
files in the .prc project and then you can tweak the segment
configuration until all is well.

Or if you want to keep those library files external (say for reuse or
distribution) then you can probably just divide them into two or more
sub-64K libraries, then add those libs into the .prc in separate
segments.  The linker doesn't care whether your code comes from source
files in the project, or a single .lib, or multiple .libs.

-slj-

Reply via email to