Author Topic: How to automatically UPX an EXE created by QB64?  (Read 2820 times)

0 Members and 1 Guest are viewing this topic.

Offline FilipeEstima

  • Newbie
  • Posts: 63
    • View Profile
How to automatically UPX an EXE created by QB64?
« on: April 25, 2019, 01:14:56 pm »
Where should I add an instruction that will, upon finishing the executable compilation, automatically UPX it?
« Last Edit: April 25, 2019, 01:16:09 pm by FilipeEstima »

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: How to automatically UPX an EXE created by QB64?
« Reply #1 on: April 25, 2019, 02:51:03 pm »
It sounds like you will need to make a shell or powershell script for that: https://www.rootusers.com/how-to-zipunzip-files-in-windows-with-powershell/

You can use SHELL to compile a QB64 file and then work with powershell to archive it, or whatever.

Is this what you are trying to do?

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline FilipeEstima

  • Newbie
  • Posts: 63
    • View Profile
Re: How to automatically UPX an EXE created by QB64?
« Reply #2 on: April 25, 2019, 03:19:55 pm »
I read somewhere in this forum that adding -o2 to internal\c\makeline.win.txt would make the compiled executables to run faster, due to better code optimization.

So this got me thinking. Maybe there is a place where I can add upx %.exe (or whatever) to automatically compress the compiled executable, every time. It is most likely doable, I just don't know exactly how or where to add code to do it.

Offline Raven_Singularity

  • Forum Regular
  • Posts: 158
    • View Profile
Re: How to automatically UPX an EXE created by QB64?
« Reply #3 on: April 25, 2019, 04:46:47 pm »
UPX is an in-place executable compressor.  It makes the EXE much smaller without significant overhead to load it.  It would be nice if QB64 used -O2 and UPX by default.

It sounds like you will need to make a shell or powershell script for that: https://www.rootusers.com/how-to-zipunzip-files-in-windows-with-powershell/

You can use SHELL to compile a QB64 file and then work with powershell to archive it, or whatever.

Is this what you are trying to do?

Pete

The optimisation parameter -O2 is just for the compiler.  You'll need to do the UPX compression after QB64 compiles the executable.  I'm not sure if there's a data/config file you can edit for adding this post compile command.  If not, you'd need to manually edit the QB64.bas file to do the UPX command, then recompile QB64.EXE.

I read somewhere in this forum that adding -o2 to internal\c\makeline.win.txt would make the compiled executables to run faster, due to better code optimization.

So this got me thinking. Maybe there is a place where I can add upx %.exe (or whatever) to automatically compress the compiled executable, every time. It is most likely doable, I just don't know exactly how or where to add code to do it.
« Last Edit: April 25, 2019, 04:47:50 pm by Raven_Singularity »