QB64.org Forum
Active Forums => QB64 Discussion => Topic started by: MarkSkits on August 12, 2018, 02:23:54 pm
-
I'm making another sort of interface in QBASIC, and it keeps running out of memory because it's in DOS. To fix this, I figured I'd separate the SUBs into different BAS/EXE files and just use a CHAIN statement, however, I cannot figure out how to have the secondary program return to the main program without restarting said main program. For example:
Main:
lastRan = "Calculator"
...
Calc.bas:
TRUE = 1
'Calculator Stuff
...
Is it possible to have it return to where it was on the main program, and if so, how can I do so?
-
You might look here.
http://qb64.org/wiki/CHAIN
though I would take a serious look at your code and see if there is anyway to resolve the memory issue. like making sure your not GOSUBing and RETURNing. make sure your not over allocating when you don't need it.
-
Ideally you'd make it all one single module (or at least one that uses included modules) instead of using CHAIN, since limitations of the past don't apply to QB64 anymore in regard to module size, but it seems you want Qbasic support on DOSbox, is that right?
In the occurrence you really are avoiding qb64 altogether, you'll have to chain back to the main program. You'll also probably need some COMMON variables to keep the program's state across CHAIN calls.
PS: QB64 does emulate CHAIN but doesn't use shared memory. All data transfer is done via a file on the disk.