Re: Optimizing size of executable
- Posted by Senator Jun 26, 2017
- 2007 views
You can use UPX to compress the executable.
You can write a little Euphoria program or routine to Translate/Compile the source code file and then call UPX to compress the executable. Something like this might work:
-- euc_compress.ex include std/filesys.e sequence cl cl = command_line() if length(cl) >= 3 then ifdef UNIX then cl= cl[3] elsedef cl = lower(cl[3]) end ifdef end if system( "euc " & cl, 0) cl = filebase(cl) system( "upx " & cl, 0)
-- UPX compression of this one line program: -- puts(1, "Hello World!\n") --Build directory: build-720630/ --Translating code, pass: 1 2 3 generating --Compiling with GCC --Compiling 14% init-.c --Compiling 57% hello.c --Compiling 85% main-.c --Linking 100% ../hello --/usr/bin/upx -- Ultimate Packer for eXecutables -- Copyright (C) 1996 - 2013 --UPX 3.91 Markus Oberhumer, Laszlo Molnar & John Reiser Sep 30th 2013 -- -- File size Ratio Format Name -- -------------------- ------ ----------- -- 210152 -> 90360 43.00% linux/ElfAMD hello -- --Packed 1 file. --Hello World! --Press any key...