Steve's $Embed thread (https://qb64phoenix.com/forum/showthread.php?tid=3142) got my curiosity going.
But first, an FYI:
For several years now I've been using the 7Zip self-extractor to compress software packages, such as editors or compiler suites, into single-file EXEs for easy transport on a thumbdrive.
7Zip's cleverly designed self-extractor stub (which I will call the .SFX) can extract these files into a temporary folder, and then execute a file of my choice. Normally the executed file would be a script to copy files into a more permanent installation folder, but I instead run that now unpacked editor or a batch file to perform compilation steps. The .SFX waits patiently and when all programs in the temp folder have ended, the .SFX conscientiously deletes that temp folder. No muss, no fuss.
This saves a lot of space on a thumbdrive, compressing a 512 megabyte (after the deletion of some non-essential MinGW files) QB64PE suite down to just 53.48 megs.
It also saves a LOT! of time. I don't know how long it would take to copy all 6350 (again, fat-trimmed) files of QB64PE to a thumbdrive, but copying MinGW alone can take several HOURS. (At least, it took that long on the thumbdrives I was using. I will never buy another SanDisk flash drive. I own several and those turkeys are all SLOW.)
(If anyone is thinking of trying the .SFX stunt described above I have to warn you that it's not for the faint-of-heart. It's a manual process that cannot be done from the 7Zip GUI. It took much time, trial, and error to get it all working the way I envisioned.)
Anyway, I created a small executable ("Hello, World", written in C) and embedded it into a QB64PE test program which would extract HELLO.EXE to disk and run it. The tester compiled and ran as it should.
Ohhhkay, now a slightly bigger test. For this one I chose CharlieJV's Basic Anywhere Machine and modded the test program to fit:
(the filenames in ExtractRun can be changed as needed)
The compiled ExtractRun with a small executable is 1.95 megs. Let's consider that the baseline, minimal ExtractRun size.
Uncompressed Basic Anywhere Machine weighs in at 4.54 megabytes.
The compiled ExtractRun with BAM is 2.81 megs (UPX can compress that down to about 1.5 megs.)
That means PE's $EMBED squeezes BAM down to just 0.86 megs.
Just posting this in case anyone wants to tinker or build with it.
But first, an FYI:
For several years now I've been using the 7Zip self-extractor to compress software packages, such as editors or compiler suites, into single-file EXEs for easy transport on a thumbdrive.
7Zip's cleverly designed self-extractor stub (which I will call the .SFX) can extract these files into a temporary folder, and then execute a file of my choice. Normally the executed file would be a script to copy files into a more permanent installation folder, but I instead run that now unpacked editor or a batch file to perform compilation steps. The .SFX waits patiently and when all programs in the temp folder have ended, the .SFX conscientiously deletes that temp folder. No muss, no fuss.
This saves a lot of space on a thumbdrive, compressing a 512 megabyte (after the deletion of some non-essential MinGW files) QB64PE suite down to just 53.48 megs.
It also saves a LOT! of time. I don't know how long it would take to copy all 6350 (again, fat-trimmed) files of QB64PE to a thumbdrive, but copying MinGW alone can take several HOURS. (At least, it took that long on the thumbdrives I was using. I will never buy another SanDisk flash drive. I own several and those turkeys are all SLOW.)
(If anyone is thinking of trying the .SFX stunt described above I have to warn you that it's not for the faint-of-heart. It's a manual process that cannot be done from the 7Zip GUI. It took much time, trial, and error to get it all working the way I envisioned.)
Anyway, I created a small executable ("Hello, World", written in C) and embedded it into a QB64PE test program which would extract HELLO.EXE to disk and run it. The tester compiled and ran as it should.
Ohhhkay, now a slightly bigger test. For this one I chose CharlieJV's Basic Anywhere Machine and modded the test program to fit:
Code: (Select All)
_Title "ExtractRun"
$Embed:'./BAM.html','embhandle'
o$ = _Embedded$("embhandle")
_WriteFile "./BAM_extracted.html", o$
If _FileExists("./BAM_extracted.html") Then Shell "start BAM_extracted.html"
End
The compiled ExtractRun with a small executable is 1.95 megs. Let's consider that the baseline, minimal ExtractRun size.
Uncompressed Basic Anywhere Machine weighs in at 4.54 megabytes.
The compiled ExtractRun with BAM is 2.81 megs (UPX can compress that down to about 1.5 megs.)
That means PE's $EMBED squeezes BAM down to just 0.86 megs.
Just posting this in case anyone wants to tinker or build with it.