I've been working on a small game project for a year or two, in good ol QB45. Just recently I went over the 64kb limit and had to start dividing up my code into modules. Here's a rough summary of the problem:
'FILE1.BAS
DIM SHARED INV$(20)
DIM SHARED FLAG$(25)
'FILE2.BAS
COMMON SHARED INV$()
COMMON SHARED FLAG$()
LET FLAG$(0) = ""
PRINT UBOUND(INV$)
The error comes with file2- both the LET and UBOUND return 'subscript out of range,' presumably because COMMON SHARED doesn't dimension a variable. I've never messed with modular programming before, can someone help point me in the right direction?
Thanks for the quick response! I think I'm getting it-- COMMON SHARED has to be included in both BAS files, and in the case of arrays, written out before DIM SHARED in the main module. This: