Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!bu-cs!dartvax!eleazar.dartmouth.edu!earleh From: earleh@eleazar.dartmouth.edu (Earle R. Horton) Newsgroups: comp.sys.mac.programmer Subject: Re: MPW C 3.0 Large progam/data Message-ID: <15957@dartvax.Dartmouth.EDU> Date: 6 Oct 89 00:42:53 GMT References: <1937@cmx.npac.syr.edu> Sender: news@dartvax.Dartmouth.EDU Reply-To: earleh@eleazar.dartmouth.edu (Earle R. Horton) Organization: Thayer School of Engineering Lines: 51 In article <1937@cmx.npac.syr.edu> polar@top.cis.syr.edu (Polar Humenn) writes: ... >I have a MACIIx with 8 bloddy megabytes of memory, and it seems that I >can't access it. I have plenty of functions and they have to go thru >this "jump table". > >Please exuse my ignorance of this Mac. However, my SUN is a 68030 and >I can access all kinds of data. With the MPW software, I can't even get >past the Linker. Global data size exceeds 32K. That seems to be a problem >but I'm not sure if it is the root of it. ... Two solutions come to mind. a) Get Aztec C. It handles both large data and large code, costs $99 from MacWareHouse with the symbolic debugger ($65 without), works under the MPW Shell, and is K&R, not ANSI. It usually produces load time locatable code, but can produce position-independent code if you take all kinds of restrictive precautions in your source files. b) It looks as if your main problem is that you haven't specified segments for your .c files at compile time. The linker is trying to put everything into the "Main" segment and it just doesn't fit. A good way to start is to segment your program on a source file basis. This is real easy if you do it with the "-s" command line option to the compiler. c blob.c -o blob.c.o -s blob ... It is even easier to specify a default rule in your Makefile that does this. This is the preferred way to do it, in my opinion, since then you don't have to put the segment name in all your source files. Apple has already changed the method of doing this in the source file once, but they haven't changed "-s" yet. Segmenting on the basis of source file is perhaps not the most sophisticated approach to the problem, but it does have the effect of breaking up your code into chunks that are small enough for the linker to handle. As a first approach to getting that huge compiler to link, it can't be beat. Large segments often provide better performance. Once you get your program in a state where it will link, you can try to combine segments at link time using the "-sg" option to the linker. You don't have to recompile files to do this. This is all based on my experience with MPW C 2.0.2. MPW C 3.0 should be the same as far as code segments go, but is supposed to handle large data, another problem. Earle R. Horton