If you have an 68K application written using CodeWarrior for Palm OS, how do you assign individual functions to different segments without manually moving files around in the segment tab in the IDE?
The CW 68K linkers support this using .seg files added to your project.
The format is
{ "<segment_name>" [= <hex>] "<name1>" ... "<namen>" }
"<segname1>" = "<segname2">
The brace delimited areas specify segment names and list all the functions/symbols that will be allocated to that segment. The optional hex value (with no leading 0x) is used to set segment attributes, so it won't be too useful on Palm OS. The other notation is used to rename a segment. This looks useful for pulling in code from a static library that has been build with "#pragma segment" calls.
This format wasn't mentioned in the CodeWarrior manuals, but when I was at Metrowerks, I checked the 68K linker source code and verified that it would work. This should work for both the Mac OS 68K Linker and Palm OS 68K Linker, as they share code that deals with segmentation.
I use #pragma segment
. Much easier than CodeWarrior's segment tab.
#pragma segment Foo
some code
#pragma segment Bar
some code
Now your code gets put in two different segments automagically.