Hallo, Joerg! Hello, everybody!
According to Joerg Tomes:
The Problem is if i want to use much memory e.g. for arrays the compiled program results in segmentation fault, while it runs with smaller arrays.
IIRC, gpc-2.0 stores global variables of the main program not in the data segment (where they belong) but in the stack segment whose size is limited in Linux (and in other systems).
Solutions:
* Upgrade to a more recent (beta) version of GNU-Pascal. See http://home.pages.de/~GNU-Pascal/ressources.html and/or ftp://agnes.dida.physik.uni-essen.de/gnu-pascal/beta/.
* Move the global variables to a Unit instead of the main program.
* Use pointers to work around:
Type Matrix = array [ 0..xsiz, 0..ysiz ] of Real;
Var d: ^Matrix;
...
New ( d ); d^ [ 42, 42 ]:= 42; Dispose ( d );
( I found this program in Gnu-C also with static arrays). [...]
Really? If you mean something like
int main ( ) { double d [ xsiz + 1 ] [ ysiz + 1 ]; }
then the array is an automatic (local), not a static variable. Then of course it causes the same problem. The following should work:
int main ( ) { static double d [ xsiz + 1 ] [ ysiz + 1 ]; }
or
double d [ xsiz + 1 ] [ ysiz + 1 ];
int main ( ) { }
Hope this helps,
Peter -- Peter Gerwinski, Essen, Germany, free physicist and programmer Maintainer GNU Pascal - http://home.pages.de/~GNU-Pascal/ - 1 Oct 1997 PGP key fingerprint: AC 6C 94 45 BE 28 A4 96 0E CC E9 12 47 25 82 75 Fight the SPAM! - http://maps.vix.com/