QB4.5 Compiler and EXE file size

Please use this Board for QBasic related requests ( file research, programming, etc.)

Moderators:Administrator, Global Moderator

Post Reply
ljbeng
Newbie
Posts:2
Joined:Fri Jan 21, 2005 5:44 pm
QB4.5 Compiler and EXE file size

Post by ljbeng » Fri Jan 21, 2005 5:55 pm

I hit a wall with my program size, I think.

I use a PC104, 386 motherboard with 1Meg memory (www.winsystems.com) for a GPS controller. I am compiling ok now, but the compiler displays:

Code: Select all

44029 Bytes Available
    0 Bytes Free

    0 Warning Errors
    0 Severe  Errors

I compiled once and got a out-of-memory error. I took out some unneeded print commands and the file compiled ok. It is a big program with a lot of variables and subs.

Would 7.1 improve my situation?

Is the 44029 a limit? What does 44029 mean? The actual exe file size is 130,554 if I compile as stand alone and 84,320 bytes if I require BRUN45.EXE.

Dr_Davenstein
QBasic God
Posts:166
Joined:Tue Mar 25, 2003 12:45 am
Location:U.S.A.
Contact:

Post by Dr_Davenstein » Sat Jan 22, 2005 12:05 am

It's bytes of memory available. You can use modules to store some of your subs, and you will be able to make the program larger. Here's a link that should help. ;)

http://support.microsoft.com/kb/q112769/
Come check out [url=http://www.freebasic.net/forum/index.php]FreeBASIC[/url]. The syntax is based on QuickBasic, but it expands to use pointers, operator overloading, etc... The list goes on and on!

Buff
Jr. Member
Posts:22
Joined:Wed May 19, 2004 3:07 pm
Contact:

Post by Buff » Mon Jan 24, 2005 4:03 am

What davenstein is talking about (I think), is using several bas files at once.

If you are only using gosubs (and maybe FN's) then consider using SUBs
and FUNCTIONs instead with most of them in other bas files. Here is how
it works. (simplistic example)

(main program)

MAIN.LOGIC:
GOSUB OPEN.FILES
GOSUB READ.DATA
GOSUB PROCESS.DATA
GOSUB CLOSE.FILES
SYSTEM
OPEN.FILES:
'open your files here
RETURN
READ.DATA:
GETINFO File1%,Record$
RETURN
PROCESS.DATA:
PROCESSIT Record$
RETURN
CLOSE.FILES:
CLOSE
RETURN
-------------------------------
(second bas file)
DECLARE SUB GETINFO(f%,rec$)
' no main code here other than dim,common,etc
SUB GETINFO(f1%,R$)
'your code here
END SUB
----------------------
(third bas file)
DECLARE SUB PROCESSIT(Rec$)
'no main code here
SUB PROCESSIT(Rec$)
'your code here
END SUB
----------------------
Now, the first time through, open the main program using File>open
Then using File>Load, load the second and third bas files.
At this point, if you use F2 you will see that all are loaded with the first
bas file as the main program.

Now save it. A MAK file will be made so that the next time you open the main program, the other bas files will automatically be loaded.

It may take some tweaking to get it to work like you want it to work this
way but there are definite advantages.

The main advantage is that each bas file is compiled separately then linked to the main program. This gives you the ability to make large programs (large at least by MS-DOS standards).

Each individual program will be subject to the 64k (about 46-48 really)
rather than having to make the one program fit in the 64k limit.

You can make programs that are 100-200 and perhaps larger using this
method.

Try it with simple programs at first to get the hang of it them move to
your project.

ljbeng
Newbie
Posts:2
Joined:Fri Jan 21, 2005 5:44 pm

Post by ljbeng » Tue Jan 25, 2005 9:27 pm

Thank you, I hope that helps.

Post Reply