The QuickBASIC compiler allocates a single segment for each module's code, of which about 45,000 bytes can actually be used to store the machine code. Depending on how the code is written, the .BAS file may be larger or smaller, but once it is used up, it cannot generate any more and would not be able to generate a valid executable for your code, so it aborts. However, you can have multiple modules in the same program. Look for the 'Create File...', 'Load File...' and 'Unload File...' items in the File menu. If they are not there, make sure 'Options'->'Full Menus' is set.
When the program is compiled, BC.EXE will be invoked separately for each .BAS file, and then LINK.EXE, which usually takes a single .OBJ and links it against the standard compile library BCOM45.LIB, will instead take all of the .OBJ files and link them against each other as well as the compile library.
Sharing data between modules is accomplished through the keywords COMMON and COMMON SHARED. Personally, though, I have experienced problems with these, and prefer to pass the required data in as parameters to the SUB or FUNCTION. If you have many calls to a SUB or FUNCTION which would need a whole whack more parameters if it had to pull in all the SHARED variables it used, you can write a "proxy" to it. First, move the SUB to the other module, and then rename it to 'ProxiedMySub' (if, for example, it is called MySub), and augment it with the parameters needed to bring in the variables. Then, in your main module, make a SUB by the original name of the SUB that takes the original parameters, and have it call the ProxiedMySub with those parameters as well as all the shared variables that it needs. I have used this method successfully.
Ultimately, however, very large projects end up becoming very difficult to accommodate in conventional memory; for porjects that get this large, it is better to use a language such as C in a 32-bit environment. However, this switch is not to be taken lightly, as you will usually need to use a completely different programming approach
