www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/12/04:38:07

Date: Wed, 12 Aug 1998 11:38:00 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Anand Singh Bisen <imbbpl AT mp DOT mp DOT nic DOT in>
cc: djgpp AT delorie DOT com
Subject: Re: Arrays giving problem
In-Reply-To: <000401bdc55c$2c5d0a40$176064a4@anandbis>
Message-ID: <Pine.SUN.3.91.980812113741.16932I-100000@is>
MIME-Version: 1.0

On Wed, 12 Aug 1998, Anand Singh Bisen wrote:

> Somebody told me that we can make huge arrays up to the order of the RAM
> available to the system but when i make a program with int ary[100000] the
> program compiles and links properly but when i run it gives some huge
> numbers with error messages. What might be the problem.

You are probably declaring that array inside a function, so it is
allocated on the stack.  DJGPP programs get a 256KB stack by default,
so any local (aka: automatic) array that's larger than that will cause
your program to crash at run time.

See section 15.9 in the DJGPP FAQ list (v2/faq210b.zip from the same
place you get DJGPP) for available methods of enlarging the default
stack.

Alternatively, you could declare the array outside a function, or
allocate its space with `malloc' at run time.

>     One more thing i would like to ask that is there any way by which we can
> use our TPU files generated in Turbo Pascal 7 with DJGPP programs or is
> there any other means by which we could use the Pascal code in DJGPP (it
> sounds foolish but i have devoted a lot of time in Pascal and i still love
> that language) ;)

In general, you can't mix object code of different compilers.  If you
have the sources of those TPU's, consider using the GNU Pascal, whose
port to DJGPP is available from the same place you get DJGPP.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019