GOTO Dav's

How to put a QB64 program and all its

needed files into one EXE using WinRar.

(Updated DEC-2010 for QB64 V0.923)

ABOUT THIS TUTORIAL: One draw back of a QB64 compiled program is that it needs a bunch of .DLL's in order to run. Wouldn't it be nice to have them all in just one file? A single EXE? Well this tutorial explains how to do just that, using WinRar to build a special archive EXE (SFX) that when started will silently unpack all needed files to a temp folder and run the QB64 program. All you have to do is distribute the one EXE file.

A finished example is here: 3dballs.exe (1.20mb). It's a sample that comes with QB64 which has been compiled + then packed using the method described here. Notice you can run it from anywhere on your computer.

1) You must have WinRar. WinRar is a great archiving program, making RAR and SFX (EXE) archives.

2) Open WinRar and select your QB64 compiled EXE and all the .DLL in the QB64 folder. This should be a total of 15 .DLL files, about 7.38MB's. Of course you need to have compiled your program with QB64 first!

NOTE: If your program is just a Qbasic type program (running Qbasic commands) you don't need to add all the DLL's. Only these 8 .DLL's are required to run a bare-bones Qbasic type program: libfreetype-6.dll, libgcc_s_sjlj-1.dll, libstdc++-6.dll, SDL.dll, SDL_image.dll, SDL_mixer.dll, SDL_net.dll, SDL_ttf.dll.

My program is a Qbasic type program, so I'm just adding the minimum .DLL's needed.

3) Now you must name the new EXE for WinRar to make. Make sure the SFX Option is checked to insure an EXE is made, not a RAR archive. Make sure your new EXE has a unique name (not your original EXE name). WinRar helps you out by putting sfx in the name. I always choose Best compression method. It's the best, I guess.

4) Under the Advanced tab, choose to enter into SFX Options....

5) Under SFX Options, General Tab, enter the name of your QB64 compiled program that will execute everytime this new WinRAR created EXE is executed. My program is called binview.exe so I named that here.

6) Still under SFX Options, click the Modes tab and check the "Unpack to temporary folder" box. Also Check the hide all option, and overwrite all files. What this does is make your new exe silently unpack all the files into a temp folder and execute your QB64 exe program. The user won't see a thing, except your QB64 program executing.

7) OPTIONAL: Here you can give the new WinRar created EXE your own icon, so windows will see it instead of the default one Winrar uses. You will need to make one with an .ICO making program. Click OK to leave the SFX Options.

8) You can see the hidden comments WinRar puts into the new EXE. It shows that it will silently unpack to a Temp folder and execute my BinView program. Don't change anything, just look at it and click OK to start making the EXE.

9) If WinRar did its job you should have a new EXE. Run it to see if it works. Here's my running program.

10) That's it! WinRar packed 9 files of 7.41MB into a single 2.01MB EXE file that unpacks and runs fine. The only difference is that now I just have 1 file to distribute and worry about instead of a bunch. Most people will never notice that it's a special SFX exe. What's more, I can even drag & drop a file on this new exe and it will pass the command parameters to the exe inside too!