BBS: Inland Empire Archive Date: 08-26-92 (09:15) Number: 224 From: MARK BUTLER Refer#: NONE To: ANSHU PANDEY Recvd: NO Subj: Compiled Size! Conf: (2) Quik_Bas
On 08-23-92 Anshu Pandey wrote to All... AP> I was astonished to find out that when I accidentally compiled AP> a 554 byte long file, it compiled into a 31 k file! Is there any way AP> to make the file size shorter w/out going to the runtime module?! ^^^^^^^^^^^^^^ +-------------------------' | If I understand what you mean by this you mean brun45.exe right? I don't like to resort to that either unless I need to. Hmmm, there are a few ways to chop that compiled size down a bit, let's run you through some options here... 1.) If you want smaller size _never_ compile from within the QB environment, do it from the command line. 2.) If your string variables are not repititive (repeating character strings across a few string variables) compile like so... C> BC MYPROG.BAS /S/O; <---- produces 'myprog.obj' 3.) Kick in these switches for linking, they help to hold things down a bit as well______ / | \ \ v v v v LINK/EX/F/PACKC/NOE MYPROG + NOCOM + SMALLERR; ^ ^^^^^ ^^^^^^^^ | \ / Note: you need this switch to tell link NOT to link in the long versions of the routines that these two stubfiles are taking the place of. Let's take a look at a little example of what this command line method of compiling will do for you as compared to compiling from within the QB environment. We'll use a simple "Hello World!" program as our example with the code as follows.. REM ** Hello.bas - a simple program that prints "Hello World!" REM ** to the screen and to a file as well. CLS Hello$ = "Hello World!" OPEN "testfile.txt" FOR OUTPUT AS #1 COLOR 14, 1 PRINT Hello$ PRINT #1, Hello$ END Now we'll take 'hello.bas' program and compile it 2 ways.. Compiled from within the QB environment: ---------------------------------------- HELLO EXE 19234 08-26-92 1:30a Compiled using the above described method: ----------------------------------------- HELLO2 EXE 17892 08-26-92 1:34a Well, we didn't perform any miracles here but we did manange to pare off 1.3k from the compiled size. Now if we used LZEXE or PKLITE on it we'd probably bring the total size down to around 8 or 9k in all. I don't know if this really helped you out much, QB is fairly notorious for being a bit on the fat side as far is it's compiled exes goes. The problem is with BCOM45.LIB's granularity... it doesn't have any! If you want better than regular QB can give you you'll have to go to PDS for that I'm afraid. Or could replace BCOM45.LIB with Tom Hanlin's "QBTINY.LIB". That creates *really* small exes but the downside is that it doesn't support many of QB's regular features. -----------> MHB :-) ... OFFLINE 1.40 * When in doubt, mumble. --- Maximus 2.01wb * Origin: Mostly Mail (1:105/319)
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