Qbasicnews.com

QBasic => QB Discussion & Programming Help => Topic started by: A.Sadjadian on February 13, 2003, 02:33:24 AM



Title: program memory overflow
Post by: A.Sadjadian on February 13, 2003, 02:33:24 AM
Dear Sirs,
I use qbasic (7.1) for programing industrial control systems run on 486 computers. At a certain (how long) size I get the error message    program memory overflow while compiling.  
The same program does execute in interpreter mode but I can not make exe from it. Is there any way out?

Best Regards
Abdollah Sadjadian


Title: 1) That's PDS 7.1. 2) That error message...
Post by: Glenn on February 13, 2003, 03:10:17 AM
means that you have to break your program up into separate modules (files), compile each .BAS file separately (with BC.EXE) and  then link them together (with LINK.EXE).  If PDS is like QB (and I think it is in this regard), you do that from within the IDE by using Load (under the File menu) to load each module in and then use the usual IDE option to make the executable.  (I just never use the IDE method.  So, if you want to use that method, you may want to get help from someone who has.)


Title: program memory overflow
Post by: Antoni Gual on February 13, 2003, 03:55:08 AM
Your output code is probably bigger than 64K.
To make a bigger program you must separate it in several modules(provided you are using SUBs and FUNCTIONS...).

-Remove some (related) subs and functions and put them in a second .bas file.
-Copy all the DECLARE lines from your main program to the top of the second file. You dont' really need them all but it will work.
-Convert all your DIM SHARED declarations to COMMON SHARED
and copy them to the top of the second file.
-Also copy all CONST definitions in the main part of your program to the top of the second file.
-Enable Full Menus if you have them disabled
-Load both files in the IDE, one with Open Program and the other one with Load File.
-Then go to Run>Set Main Module and select your main program.

If i'm not forgetting nothing it should run and compile correctly.


Title: If any of those DIM SHARED statements,...
Post by: Glenn on February 13, 2003, 12:22:54 PM
were defining arrays, he still needs the DIM statement (in addition to the COMMON SHARED statement).   He just doesn't need the SHARED attribute in it.  COMMON statements don't dimenionalize arrays.  They just store their addresses.


Title: program memory overflow
Post by: Antoni Gual on February 14, 2003, 07:39:31 PM
Also:
- TYPES must be re-declared in the second module if some variable there uses them.
-DATA read by subs/functions in the module must be moved to it..

Now you can be sure at 99% it will work.... :D


Title: Yup.
Post by: Glenn on February 15, 2003, 12:30:46 AM
.