forumexp@rpitsmts.UUCP (09/16/87)
According to BYTE magazine, Turbo C has a problem linking large memory models. I think the problem was they didn't compile right. How can I tell if my copy is bad (I purchased it late-July.) I have not used large models yet, so I don't know if I'm affected. I don't have the infamous inverted division error ( 4/2 = .5). Does anyone know of any other bugs Borland has not bothered to announce yet?
jtliu@phoenix.UUCP (09/17/87)
In article <7871.1684.forumexp@mts.rpi.edu> Howard Kapustein writes: > > According to BYTE magazine, Turbo C has a problem linking > large memory models. I think the problem was they didn't > compile right. How can I tell if my copy is bad (I purchased > it late-July.) I have not used large models yet, so I don't > know if I'm affected. I don't have the infamous inverted division error > ( 4/2 = .5). >... I don't know if this link problem has been brought up before, but I ran into this when compiling a large program. Apparantly, the problem occurs when linking (compiling is not a problem) large memory model programs using the emulator library (emu.lib). This is what I have been able to figure out: Routine fpexcep in the emulator library calls _exit (which is defined in the main library, cl.lib) with a near call. This means fpexcep and _exit has to be loaded within 64K of each other. The problem occurs because fpexcep resides in segment _TEXT which is defined in c0l.obj and thus occurs at the beginning of the executable. However, _exit is defined in EXIT_TEXT in library cl.lib, and this does not get loaded until externals are resolved by the linker. This means, _exit gets loaded after all of your program modules. Thus, if your program code is longer than 64K, you'll run into this bug. I believe the linker reports 'fixup offset exceeds field width in module fpexcep', or something like that. I've found a simple way to fix this. All you have to do is to assemble the following file: exit_text segment para public 'code' exit_text ends end and include this right after c0l (which should be the first file linked). What this does is to force segment EXIT_TEXT to be loaded right after segment _TEXT, thus forcing fpexcep and _exit to be within 64K of each other. I believe this works, but I really haven't tested it that extensively. - Jim Liu (DEI)