sparks@batcomputer.tn.cornell.edu (Steve Gaarder) (04/29/88)
I am in urgent need of a linker for the MPW system that can handle a global data area in excess of 32K. My target program includes a data area exceeding 150K. Does anyone have a pre- release, or tweaked, or "fixed" version of the linker that allows a larer global area? It appears that the linker takes all string and numeric constants, no matter what the module scope, and puts them into one CODE resource. I am in desperate need of this fix. Please contact me as soon as possible if you have ANY information, hints or suggestions. Please Email replies if possible; I will summarize. -- Steve Gaarder Cornell University, 171 Hollister, Ithaca NY 14853 607-255-5389 UUCP: {cmcl2,shasta,rochester,uw-beaver}!cornell!batcomputer!sparks BITNET: sparks@crnlthry.BITNET ARPA: sparks@tcgould.tn.cornell.edu
aw0g+@andrew.cmu.edu (Aaron Wohl) (04/29/88)
I ran into the same problem. In my case most of the static space was in double quote literals. I made up a preprocessor MPW tool that removes the double quote literals and replaces them with a macro. The strings are loaded at runtime from a resource file. This cuts data space usage from one byte per string character to 4 bytes per c source file. If this doesn't free up enough space change a few large arrays to be pointers to malloced(NewPtr) memory. The preprocessor is available from [ghostwheel,128.2.35.1] via anonymous ftp as the file gstring.tar. (gstring, strip down to the most bare that is legal). Don't forget to transfer it in binary mode. See the sample .r file and Makefile for how to use it. The following are handled: A sample expansion for file barf.c: #include <stdio.h> main() {printf("hello world\n"); printf("foo\n"); } becomes: char *qv_barf; ... expansion of #include <stdio.h> ... main() {printf((qv_barf+0L)); printf((qv_barf+14L); } So executable code works well. Initilized statics are more trouble. Statics declared inside functions are not handled. Private staticaly allocated strings (with 'static') become global. [static] char *string1="s1"; this becomes char *string1=0L; with code to initilize the string at startup [static] char *str_array[]={ "ar1", "ar2", }; This is initilized at startup in a similer fashion. [static] char mumble[]="mumble"; This is left as is so sizeof(mumble) works. Well anyway, gstring is rather ad hoc and doesn't handle everything. It did save the day in porting a large unix land program to the mac. Aaron Wohl (aw0g+@andrew.cmu.edu)