What's the smallest .exe you were able to create?

BlitzMax Forums/BlitzMax Programming/What's the smallest .exe you were able to create?

JoJo(Posted 2005) [#1]
Framework brl.blitz
import brl.standardio

print "Hello"


...seems to create the smallest .exe in release mode. I got 33kb.


I have notice that by using the brl.blitz mod, you wont import any other mods that you may not use.

So if you want to scale down your projects .exe I would suggest using Framework brl.blitz, and then the appropriate imports.

And after looking in all the mod folders, every single mod imports the brl.blitz mod.

So after saying that, it looks like this will be all you need.
Framework brl.standardio

print "Hello"


...which still gives you 33kb.


Russell(Posted 2005) [#2]
If you modify the modules yourself (not recommended!) you could probably get less than 10k.

I think PureBasic does that in 7k... ;)

Russell


Muttley(Posted 2005) [#3]
If you use UPX on that afterwards to compress the .exe you can get it to 14.5KB. ;)

Muttley


MrCredo(Posted 2005) [#4]
MinGW create fat exe's!

The old version of MinGW (you find it in old DevCpp-package) create very small exe's - but with this verion, you can't build modules :-/


Clyde(Posted 2005) [#5]
Sorry to be thick. I've noticed framework used in BMAX programs, I Presumed at first they were like includes to only use certain modules. I am way off thinking that I think?

So what is the point of using Framework in your programs?

And my exe's are 763 KB.

Kind Regards,
.:|THUMBZ|:.


Kanati(Posted 2005) [#6]
framework limits what gets compiled into the exe.


flaith(Posted 2005) [#7]
@jojo

look into dir .bmx and the file 'xxxxx.bmx.i' :

import brl.blitz
import brl.standardio

even with the 'Framework brl.standardio' BMax add brl.blitz


Bot Builder(Posted 2005) [#8]
I've got it down to 10.5Kb (with upx) but you need MingW:
Strict
Framework brl.blitz
Import "trimmed_stdc.c"

Extern "c"
	Global stdout_="stdout_"
	Function Startup()="bb_stdc_Startup"
	Function fwrite_( buf:Byte Ptr,size,count,c_stream )="fwrite"
End Extern
Startup
fwrite_( "Hello World".ToCString(),1,12,stdout_ )
trimmed_stdc.c:
#ifdef __cplusplus
extern "C"{
#endif

#ifdef _WIN32
# ifdef _MSC_VER
#  pragma warning(disable:4007)	//cdecl warning
#  pragma warning(disable:4786)	//debug info>255 chars
#  pragma warning(disable:4530)	//exceptions not enabled
# endif
# include <direct.h>
# define mkdir(X,Y) mkdir(X)
# define realpath(X,Y) _fullpath(Y,X,MAX_PATH)
# define OS_WIN32 1
# define CPU_X86 1
#endif

#ifdef __APPLE__
# include <unistd.h>
  char*	itoa( int n,char *t,int radix );
  int	stricmp( const char *x,const char *y );
# define OS_MACOSX 1
# define CPU_PPC 1
#endif

#ifdef __cplusplus
}
#endif

#if _WIN32
#include <winsock.h>
#else
#include <sys/types.h>
#endif
 
int stdout_;

void bb_stdc_Startup(){
#if _WIN32
	WSADATA ws;
	WSAStartup( 0x101,&ws );
#endif
	stdout_=(int)stdout;
}
Still not as small as purebasic's, but then again, purebasic also writes direct assembly.


Robert(Posted 2005) [#9]
PureBasic doesn't have a garbage collector or object-orientated programming features amongst other things. Hence the minimal Blitz runtime is larger.


Russell(Posted 2005) [#10]
That's true. But it still has a large number of libraries that it is able to reduce to the absolute minimum. I'm sure this will be a common feature in a near future version of Max (module parsing).

On the other hand, file size reduction doesn't seem to be a big deal nowadays, with cheap memory\storage and many people on broadband. These programmers could not have existed in the good 'ol 8 bit days ;)

Russell


Kanati(Posted 2005) [#11]
I could care less if the exe is 1 meg or 20 meg... As long as it runs and runs well.