Qbasicnews.com
memory overflow comiling larg program - Printable Version

+- Qbasicnews.com (http://qbasicnews.com/newforum)
+-- Forum: QBasic (http://qbasicnews.com/newforum/forum-4.html)
+--- Forum: QB Discussion & Programming Help (http://qbasicnews.com/newforum/forum-11.html)
+--- Thread: memory overflow comiling larg program (/thread-1630.html)



memory overflow comiling larg program - A.Sadjadian - 07-30-2003

Dear Qbasicers
Salaam
Back in Feb.2003 I asked for help to tackel too long qbasic programs and received some advice that made compiling possible.
Howver I now find that when I break a long program into 2 parts the second part does not recieve the arrays even though all dim statements are copied at its top. Could anybody help.

I use qbasic 7.1 on vintage 486 computers to build control systems for the industry.(up to 384 I/O lines so far)

Best Regards
A.Sadjadian


memory overflow comiling larg program - Plasma - 07-30-2003

Main module:

Code:
COMMON SomeArray()
COMMON AnotherOne()
DIM SHARED SomeArray(whatever)
DIM SHARED AnotherOne(whatever)

Other modules:

Code:
COMMON SomeArray()
COMMON AnotherOne()

Make sure that you keep the COMMON statements in the same order in all the modules. Or you can use blocks (/something/).


memory overflow comiling larg program - Antoni Gual - 07-31-2003

Check the FAQ
http://faq.qbasicnews.com/?blast=ModularizeIt


program memory overflow - A.Sadjadian - 07-31-2003

Dear Plasma 357
Thank you for the help. However the code you posted does not work as I get the message subscript out of range for the first array member used in a sub in the second (not main) module. There seems that DIM shared statements have to be in all moduls but that is not enough as then I do not get the above error but the array members can not be manipulate in moduls other than the main.

I will be trying the solutions in ModularizeIt next. and will report the results.
Thanks again
A.Sadjadian


memory overflow comiling larg program - Plasma - 07-31-2003

I had it backwards...should be COMMON SHARED and then DIM , not COMMON and DIM SHARED. (SHARED is not needed with DIM in this case, but if you use it nothing changes)

Code:
DECLARE SUB test1 ()
DECLARE SUB test2 ()

COMMON SHARED a()
COMMON SHARED b()
DIM a(100)
DIM b(500)

CLS
test1
test2

SUB test1

  a(0) = 1
  a(100) = 2
  b(0) = 3
  b(500) = 4

END SUB

Code:
DECLARE SUB test2 ()

COMMON SHARED a()
COMMON SHARED b()

SUB test2

  PRINT a(0), a(100), b(0), b(500)

END SUB



memory overflow comiling larg program - TheBigBasicQ - 07-31-2003

http://faq.qbasicnews.com/?blast=PushingTheLimitsOfQb

Try this. I think it is the link Antoni provided you with leads to the samething 8)