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?
如果您使用CodeWarrior for Palm OS编写68K应用程序,如何在不在IDE中的段选项卡中手动移动文件的情况下将各个功能分配给不同的段?
2 个解决方案
#1
3
I use #pragma segment
. Much easier than CodeWarrior's segment tab.
我使用#pragma segment。比CodeWarrior的分段选项卡容易得多。
#pragma segment Foo
some code
#pragma segment Bar
some code
Now your code gets put in two different segments automagically.
现在,您的代码将自动放入两个不同的段中。
#2
2
The CW 68K linkers support this using .seg files added to your project.
CW 68K链接器使用添加到项目中的.seg文件来支持此功能。
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.
大括号分隔区域指定段名称并列出将分配给该段的所有功能/符号。可选的十六进制值(没有前导0x)用于设置段属性,因此在Palm OS上它不会太有用。另一种表示法用于重命名段。这对于从使用“#pragma segment”调用构建的静态库中提取代码非常有用。
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.
CodeWarrior手册中没有提到这种格式,但是当我在Metrowerks时,我检查了68K链接器源代码并验证它是否可行。这应该适用于Mac OS 68K Linker和Palm OS 68K Linker,因为它们共享处理分段的代码。
#1
3
I use #pragma segment
. Much easier than CodeWarrior's segment tab.
我使用#pragma segment。比CodeWarrior的分段选项卡容易得多。
#pragma segment Foo
some code
#pragma segment Bar
some code
Now your code gets put in two different segments automagically.
现在,您的代码将自动放入两个不同的段中。
#2
2
The CW 68K linkers support this using .seg files added to your project.
CW 68K链接器使用添加到项目中的.seg文件来支持此功能。
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.
大括号分隔区域指定段名称并列出将分配给该段的所有功能/符号。可选的十六进制值(没有前导0x)用于设置段属性,因此在Palm OS上它不会太有用。另一种表示法用于重命名段。这对于从使用“#pragma segment”调用构建的静态库中提取代码非常有用。
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.
CodeWarrior手册中没有提到这种格式,但是当我在Metrowerks时,我检查了68K链接器源代码并验证它是否可行。这应该适用于Mac OS 68K Linker和Palm OS 68K Linker,因为它们共享处理分段的代码。