modules!!

 BBS: Inland Empire Archive
Date: 07-20-92 (12:40)             Number: 159
From: MILES HUFFORD                Refer#: NONE
  To: JOHN GALLAS                   Recvd: NO  
Subj: modules!!                      Conf: (2) Quik_Bas
-> Could someone PLEASE explain exactly how seperate modules work?  I'm
-> trying to break up my program into 2 modules, so that it will be in t
-> right size for the compiler, but it isn't working..  Can I call
-> subroutines from the 1st module from within a sub from the 2nd?  And
-> do I have variables that will work in both modules and in both module
-> subroutines?  I've found that DIM SHARED doesn't work across differen
-> modules..  Can somebody help me??


You need to use the COMMON SHARE statement.
Something like:

COMMON SHARED Array()
DIM Array(1 TO 100) AS SINGLE

The order of the COMMON SHARED statements is very important.  They
must appear in the same order in each module.  The best way to do that
is to create a separate INCLUDE file that contains your COMMON SHARED
statements.  You then use a line at the top of each module such
as:

'$INCLUDE: 'COMMON.BI'

The name COMMON.BI is just a file name you chose.  The DIM statements
appear just below the include statements only in your 1st main module.
You can call a SUB from anywhere in any module.


--- WM v2.01/92-0162
 * Origin: The Huff & Puff BBS (602)-996-0033 USR DS (1:114/144)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET