Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!lll-crg!nike!ucbcad!ucbvax!CORY.BERKELEY.EDU!dillon From: dillon@CORY.BERKELEY.EDU (Matt Dillon) Newsgroups: net.micro.amiga Subject: Re: YALP -- Yet Another Linker Problem Message-ID: <8608230148.AA00629@cory.Berkeley.EDU> Date: Fri, 22-Aug-86 21:48:15 EDT Article-I.D.: cory.8608230148.AA00629 Posted: Fri Aug 22 21:48:15 1986 Date-Received: Sat, 23-Aug-86 02:07:39 EDT Sender: daemon@ucbvax.BERKELEY.EDU Organization: University of California at Berkeley Lines: 41 >Ooops, after looking at the map output of ALINK, I found a rather >large variable. Turned out that there was an external variable >declared as double array [300][300]. wow. I guess alink wanted >that much room on disk or something. > >Is there any way of making a large array (I know, this one is too big), >external and automatic at the same time? I mean will auto declaration >work on this external? Usually it isn't a good idea to allocate such a large array on the stack, but if you wanted to, you could declare it on the stack inside main(), then set some global pointer to point to the array. But remember, most people only have 4-8K stacks allocated for the program. The solution is to declare a pointer to an array of that size, then use AllocMem and dynamically allocate the memory: extern char *AllocMem(); double *(ptr[300][300]); /* make this a global declaration */ main() { ptr = (double *)AllocMem((long)sizeof(double) * 300L * 300L, MEMF_PUBLIC) . neat stuff and all around niceness. . . . FreeMem(ptr, (long)sizeof(double) * 300L * 300L); } HOWEVER, I would like to point out a small problem: 8 * 300 * 300 = 720000 = 703K. Hope you have the memory. -Matt