Frequently, the interpreter makes up for little steps that the programmer has skipped -- for instance, not explicitly DIM'ing arrays -- but the compiler is not so lenient. Also, the IDE allocates static arrays from its heap at runtime, whereas the compiler pre-allocates the arrays inside the code segment (ie, reserves memory for them), so having more than 64k of static variables plus code in any function can run in the IDE, since the IDE basically treats all data chunks as dynamically allocated, but won't compile, since the compiler wants to keep any given subroutine inside of one segment. The solution is to make the compiler treat these variables as dynamic variables too. Careful, though; dynamic variables have a bit of a higher overhead than static variables, so you should take care to make as few variables dynamic as possible. To tell the compiler to treat all further variables that it encounters as dynamic, use the metadirective:
[tt]
'$DYNAMIC[/tt]
If you specify a DIM statement directly afterward, the corresponding variables & arrays will be allocated dynamically when the program is compiled. To specify that subsequent variables and arrays should be static, use the metacommand:
[tt]
'$STATIC[/tt]
For instance, to make just the array scrbuf&() dynamic, you could use the following sequence:
[tt]
'$DYNAMIC
DIM scrbuf&(16000)
'$STATIC
' rest of program here[/tt]