Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!rutgers!clyde!cbosgd!gwspc!cbcsta!n8emr!oink!jep From: jep@oink.UUCP (James E. Prior) Newsgroups: comp.sys.ibm.pc,comp.lang.c Subject: Re: TURBO C Linking Problem Message-ID: <190@oink.UUCP> Date: Thu, 12-Nov-87 22:52:19 EST Article-I.D.: oink.190 Posted: Thu Nov 12 22:52:19 1987 Date-Received: Sun, 15-Nov-87 17:08:34 EST References: <2293@watcgl.waterloo.edu> Reply-To: jep@oink.UUCP (James E. Prior) Distribution: na Organization: Random Prime Research Institute Columbus, Ohio Lines: 66 Keywords: TURBO C Linking Xref: mnetor comp.sys.ibm.pc:10159 comp.lang.c:5414 I have a solution to the TURBO C Linking Problem. In article <2293@watcgl.waterloo.edu> smvorkoetter@watmum.waterloo.edu (Stefan M. Vorkoetter) writes: > >I am having problems linking a program with TURBO C. The program consists >of about 15 source files. Each and every one compiles, but when I link, >I get an error when CH.LIB is being linked in that there is too much global >data defined in a file. None of my files defines more than 64K of global >data. As a matter of fact, the entire program uses less than 64K of global >data. Unfortunately, it won't even tell me which file is the supposed >culprit. I have double checked that the model is selected properly, and that >everything else is set right. I am running under the integrated environment. > >By the way, the program I am compiling is a C compiler that I am developing. >Perhaps this is Borland's way of preventing competition :-) > >Any help on this matter would be appreciated. The program compiles fine >under 4.3 BSD. I am not doing anything the least bit esoteric anywhere. > >Thanks in advance, >Stefan Vorkoetter >Symbolic Computation Group >University of Waterloo >(smvorkoetter@watmum.waterloo.edu) I had a similar problem with Turbo C, and have a way of coping with it. I was working on a program with much data. I was already using the compact memory model (64K code, 1M data). I added more and more arrays of initialized structures. Eventually, the linker complained that I had too much global data. I split the arrays into many modules, so that every module was well under 64K of initialized data. It still croaked. I changed from Turbo's TC environment to conventional command line invokations of tcc and tlink. Tlink would always croak. I switched to the huge model. It is supposed to handle more than 64K of initialized data. It still croaked, both in the tc environment and by tcc and tlink. I finally called Borland's technical support number, and they knew both the problem and the solution. The problem is a bug in their tlink program. The solution is to use the ordinary link program. Their support staff didn't waste anyone's time. My entire call was under five minutes. They were smart. They asked the right questions. Following are excerpts from my makefile, that *do* work for me. # huge memory model: 1M code, 1M data MODEL=h CFLAGS=-Ic:\tc -m$(MODEL) -c jem2set.exe: \ . . dependencies omitted . rem tlink /c /m /s ..\c0$(MODEL) @obj.lst, jem2set.exe,, ..\cusrc\a$(MODEL)curses ..\emu ..\math$(MODEL) ..\C$(MODEL) \msc4\link /NOI /STACK:4096 /SEGMENT:256 ..\c0$(MODEL) @obj.lst, $*,$*, ..\cusrc\a$(MODEL)curses ..\emu ..\math$(MODEL) ..\C$(MODEL) BTW, I used Polymake since I have used it for years. I didn't feel like messing with Turbo make, so I can't say anything good or bad about it. Warning: There are an amazing number of link.exe's by Microsoft. I used the one that came with Microsoft C 4.0 . I doubt that some of the older versions will work, especially the ones supplied with DOS. -- James E. Prior {ihnp4|cbosgd}!n8emr!oink!jep