[fpc-pascal] Will the size of an executable depend on the uses clause

Travis Siegel tsiegel at softcon.com
Thu Jun 17 06:07:17 CEST 2021

Thanks for the sample.  For what it's worth, I got the executable down 
to just 10K using powerbasic version 6,  I suspect that's as small as it 
can get, since I did have to include a winbase.inc that comes with the 
compiler to get the function call of the GetTickCount64 call.  But then 
again, I cheated a bit by only having a single print statement where I 
formatted the output to my liking by simply using semicolons to string 
the various pieces of information together.

Powerbasic isn't cross platform, but it does consistently produce the 
smallest executables I've ever seen in the windows environment, and I've 
been using it for more than 20 years.

I do use fpc when I need cross platform capabilities though, so there is 

On 6/16/2021 5:49 PM, Jean SUZINEAU via fpc-pascal wrote:
> My best score is 67 kb after strip -s with the code below ... ;-)
> Of course it will not work on every  version of Windows.
> program uptime;
> function GetTickCount64: QWord; stdcall; external 'kernel32.dll';
> function _2d( _i: Integer): String;
> begin
>      Str( _i, Result);
>      if Length(Result) < 2 then Result:= '0'+Result;
> end;
> function FormatUpTime( _tc: QWord): String;
> var
>    t, d, h, m, s: Integer;
>    sd: String;
> begin
>      t:= _tc div 1000;
>      s:= t mod 60;
>      m:= (t div 60) mod 60;
>      h:= (t div 3600) mod 24;
>      d:= (t div 86400);
>      Result:= _2d(h)+':'+_2d( m)+':'+_2d( s);
>      if 0 = d then exit;
>      Str( d, sd);
>      Result:= sd+' '+Result;
> end;
> begin
>      WriteLn( FormatUpTime( GetTickCount64));
> end.
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

More information about the fpc-pascal mailing list