[net.micro.amiga] YALP -- Yet Another Linker Problem

adp@hp-sdd.UUCP (08/18/86)

[ HELP ME!!! I'M MELTin..

     I'm porting some code (runs on unix, should be generic C) and
everything compiled fine, but ALINK gave me this message:

Linker error:  Insufficient Store During Pass 2
Linking abandoned.

     I haven't found any obvious problems, of course no mention
of the message in the developers manual.  This must be one of the
"Self-explainitory" messages.

     Anyone else get this error, how did you fix it.

     Sorry if this turns out to be caused by my own stupidity.

     BTW, I am running 1/2 Meg ram and external disk.  The program
doesn't seem too big, lots of disk space left also.  The object
modules in this link (other than the libs, etc) total about 50k at most.

-- Thanx in advance.


*** REPLACE THIS LINE WITH YOUR MESSAGE ***
-- 
*******************************************************************************
*      Tony Parkhurst -- {hplabs|sdcsvax|ncr-sd|hpfcla|ihnp4}!hp-sdd!adp      *
*                        OR   hp-sdd!adp@nosc.arpa                            *
*******************************************************************************

higgin@cbmvax.cbm.UUCP (Paul Higginbottom) (08/21/86)

In article <397@hp-sdd.UUCP> adp@hp-sdd.UUCP (Tony Parkhurst) writes:
>     I'm porting some code (runs on unix, should be generic C) and
>everything compiled fine, but ALINK gave me this message:
>
>Linker error:  Insufficient Store During Pass 2
>Linking abandoned.
>
>     I haven't found any obvious problems, of course no mention
>of the message in the developers manual.  This must be one of the
>"Self-explainitory" messages.
>...
>     BTW, I am running 1/2 Meg ram and external disk.  The program
>doesn't seem too big, lots of disk space left also.  The object
>modules in this link (other than the libs, etc) total about 50k at most.
>
>-- Thanx in advance.
>*******************************************************************************
>*      Tony Parkhurst -- {hplabs|sdcsvax|ncr-sd|hpfcla|ihnp4}!hp-sdd!adp      *
>*                        OR   hp-sdd!adp@nosc.arpa                            *
>*******************************************************************************

I don't use ALINK, but it sounds like the linker has run out of RAM.
If you have stuff in your Ram disk, get rid of it, and try linking again (if
this is the problem).

	Hope this helps,
		Paul.

Disclaimer: I do not work for Commodore and my opinions are my own.

danny@convex.UUCP (08/21/86)

Insuficient store?  Hmmm.

Try doubling your stack size.  I have Manx so I'm just guessing.
See if there's a flag to set the 'store size'?

Hope this helps.

Dan

adp@hp-sdd.UUCP (Tony Parkhurst) (08/22/86)

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?
-- 
*******************************************************************************
*      Tony Parkhurst -- {hplabs|sdcsvax|ncr-sd|hpfcla|ihnp4}!hp-sdd!adp      *
*                        OR   hp-sdd!adp@nosc.arpa                            *
*******************************************************************************

dillon@CORY.BERKELEY.EDU (Matt Dillon) (08/23/86)

>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

walker@sas.UUCP (Doug Walker) (08/28/86)

> 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?

You should allocate storage dynamically for arrays that size unless you 
want them to take up that much space on disk.  No alternative, sorry.