Главная страница | назад





Article #16529: Limit of 254 segments exceed workaround

 Question and Answer Database
QNA :Limit of 254 segments exceed workaround
Category :Linking
Platform :Windows95
Product :BC++ 5.x
Question:
In a Large Model project already using Automatic Far Data and
setting threshold to a working number you are exceeding the
254 segment maximum imposed by Windows, and the linker complains.
What to do?
Answer:
If you add the __far keyword to each data element and set the
pragma options as below, you will end up having the various
elements under the same far data segment. If they go above
64K, use the same approach on a new file, changing the Data
Segment Name on the pragma directive:
// Sets the name of the segment where far objects are placed
#pragma options -zEFAT_DATA
// Use the keyword __far to move the data into the named
// far data segment
int __far fat_x = 3;
char __far fat_foo[35] = "hello";
struct {
double r1, r2, r3;
double zy, yz;
} __far far_s = {1, 2, 3, 4, 5};
void main (void) {
}
// Build with bcc -M and check the map file for the segment
placements.
7/2/1998 10:32:32 AM

Last Modified: 01-SEP-99