TIP: Click on subject to list as thread! ANSI
echo: quik_bas
to: Marty Blankenship
from: MIKE ROSS
date: 2004-04-30 10:22:08
subject: Compiler error

"Marty Blankenship" bravely wrote to "All" (29 Apr 04  22:41:32)
 --- on the heady topic of "Compiler error"

 MB> How can I split a basic program into 2 different *.bas files and
 MB> compile them  into one exe file? I am trying to compile a large program
 MB> in QBX 7.1 and I get an error when I try to compile it. It runs great
 MB> via the ide but when I try to compile it it gives me the following
 MB> error.
 MB> program-memory overflow

 MB> 1FBE    116C

 MB> 45820 bytes available
 MB> 0 bytes free

 MB> I tried to toggle every switch that I could and the only thing that
 MB> changes is the 1FBE. The main module shows 54k when I view the subs
 MB> screen and each of  the 3 other subs are at 1k, 1k, and 5k.

You need to create "modules" from the "main" program or
main module
(same thing just a different term used interchangably). Then you move
related subroutines into each module. The "main" module would then
have only the essential program flow and the subroutines would be
separated into their respective modules. For example, the "main"
module would have the code to make a choice of operation but then the
subroutines to execute it would be in the specific module. Check out
the sample programs, here's an example: (double quotes '' are my
comments, separate each section into their respective files)

'' TESTMOD.MAK  this is the contents of the loader MAK file

TESTMOD.BAS
THEMODUL.BAS

''---------------------------------------
'' TESTMOD.BAS  this is the main program or module
''              note: the INC file loads by itself

'$INCLUDE: 'themodul.inc'

CALL FetchYstuff

CLS

PRINT y.ystuff
'PRINT z(0)
PRINT z


Parm = 1
CALL ModulesRus(Parm)
PRINT a

Value = 2
CALL AnotherSub(Value)
PRINT b

PRINT x(1)
END

''---------------------------------------
'' THEMODUL.BAS  this is the module

' The include file "themodul.inc" in the main module
' contains the declares for this module.
' $INCLUDE: 'themodul.inc'

SUB AnotherSub (Value AS INTEGER)
b = Value + 2
x(1) = "AHA"

END SUB

SUB FetchYstuff
y.ystuff = "B" + CHR$(41)
a = b + 1
'z(0) = STRING$(1, "$"):
z = STRING$(1, "$"):
END SUB

DEFINT A-Z
SUB ModulesRus (Parm AS INTEGER)
 a = Parm + 1
END SUB

''---------------------------------------
'' THEMODUL.INC  this is the include for the main & module

DECLARE SUB ModulesRus (Parm AS INTEGER)
DECLARE SUB AnotherSub (Value AS INTEGER)
DECLARE SUB FetchYstuff ()

DIM x(1 TO 5) AS STRING * 3

TYPE Ytype
 ystuff AS STRING * 2
END TYPE

'DIM z(0) AS STRING * 1

COMMON SHARED /modulevariables/ z AS STRING * 1
'COMMON SHARED /modulevariables/ z() AS STRING * 1
COMMON SHARED /modulevariables/ y AS Ytype
COMMON SHARED /modulevariables/ Parm AS INTEGER
COMMON SHARED /modulevariables/ Value  AS INTEGER
COMMON SHARED /modulevariables/ a AS INTEGER
COMMON SHARED /modulevariables/ b AS INTEGER
COMMON SHARED /modulevariables/ x() AS STRING * 3

'DIM z AS STRING * 1

''---------------------------------------

Good luck!

 Mike
 ****

... Documentation...The stuff you wipe up coffee with.
--- Blue Wave/DOS v2.30
* Origin: Juxtaposition BBS, Telnet:juxtaposition.dynip.com (1:167/133)
SEEN-BY: 633/267 270
@PATH: 167/133 379/1 396/45 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.