Yet another Module question... - 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: Yet another Module question... (/thread-1937.html) |
Yet another Module question... - Rokkuman - 09-08-2003 Alright, I can share non-arrayed variables (X,Y, and Z) just fine. I have an include file with the "Common Shared" statements, and it works perfectly. But how do I get arrays like "Sprite(36,43)" shared throughout all of the modules? I hope I explained that right... thanks. Yet another Module question... - Ninkazu - 09-08-2003 DIM SHARED in a bi file. Yet another Module question... - Rokkuman - 09-08-2003 Didn't work... it's "5" in one module... "0" in the other... Yet another Module question... - Sterling Christensen - 09-08-2003 blah.bi: Code: COMMON SHARED myArray() AS DOUBLE blah.bas (main module): Code: '$INCLUDE:'blah.bi' blah2.bas (secondary module): Code: '$INCLUDE:'blah.bi' You could put a DIM SHARED in blah2.bas if you really wanted to, but it wouldn't do anything... just like the PRINT statement in blah2.bas. Module-level (outside of any SUB/FUNCTION) executable statements (like PRINT or DIM, not like DEFINT or COMMON) are ignored unless they're in the main module. Yet another Module question... - Rokkuman - 09-08-2003 I did that, and now in the MAIN module, it's telling me "array already dimensioned"... GAAAAH! Yet another Module question... - Agamemnus - 09-08-2003 hey megaman, what you can do is just make yourself a program that copies together two programs (gets rid of the DECLAREs and puts them all at the front, too).... or use plasma's routines... (dunno where they actually are) Yet another Module question... - Sterling Christensen - 09-08-2003 Quote:I did that, and now in the MAIN module, it's telling me "array already dimensioned"... GAAAAH!Make absolutely sure there is only one (1) DIM for that array in the entire project. It's only the COMMON SHAREDs that should be in all the bas files, or just in the bi. Quote:hey megaman, what you can do is just make yourself a program that copies together two programs (gets rid of the DECLAREs and puts them all at the front, too)....Open QB, Click File->Merge... Yet another Module question... - Agamemnus - 09-08-2003 oh....... Yet another Module question... - Rokkuman - 09-08-2003 Did it, now I'm getting "Duplicate Definition"... *growl* Yet another Module question... - ak00ma - 09-08-2003 Do it like this... blah.bi: Code: COMMON SHARED map() AS STRING * 1 blah.bas: Code: REM $INCLUDE: 'blah.bi' You have to 'REDIM' the 'COMMON SHARED' array in every module. So you can just put the REDIM into the bi file and you get it. |