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

2021-06-20 Thread Florian Klämpfl via fpc-pascal
> Am 16.06.2021 um 18:07 schrieb Dennis Lee Bieber via fpc-pascal > : > > On Wed, 16 Jun 2021 13:15:10 +0200 (CEST), Michael Van Canneyt via > fpc-pascal > declaimed the following: > >> ~$ ldd /usr/bin/ls >> linux-vdso.so.1 (0x7ffc3f9c1000) >> libselinux.so.1 =>

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

2021-06-19 Thread wkitty42--- via fpc-pascal
On 6/19/21 9:40 AM, Bo Berglund via fpc-pascal wrote: Strange name of a function, though, is that needed? idk why the specific name was selected but you need some easy way to add leading zeros if you want them... some might complain about the conversion from integer to string, though... i've

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

2021-06-19 Thread Jean SUZINEAU via fpc-pascal
Le 19/06/2021 à 15:40, Bo Berglund via fpc-pascal a écrit : function _2d( _i: Integer): String; Strange name of a function, though, is that needed? No, it's not needed, it's just my odd way of naming ... ;-)  (the closer to %.2d ). ___ fpc-pascal

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

2021-06-19 Thread Bo Berglund via fpc-pascal
On Fri, 18 Jun 2021 18:13:52 +0200, Jean SUZINEAU via fpc-pascal wrote: > >function _2d( _i: Integer): String; >begin > Str( _i, _2d); > if Length(_2d) < 2 then _2d:= '0'+_2d; > >end; Thanks, it seems like this gets rid of the Format call, which probably brings in a lot of un-needed

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

2021-06-18 Thread Jean SUZINEAU via fpc-pascal
Ooops... little overflow bug My computer has reached 33 days of uptime today and with var     t, d, h, m, s: Integer; you switch to the negative side ... I got a display like : -8:-4:-52 Replacing with QWord solved the problem (I imagine DWord would just allow for something like 66 days) var

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

2021-06-17 Thread Travis Siegel via fpc-pascal
Heh, how very cool.  I wasn't aware powershell could do such things.  All kinds of new things learned in this thread.  Thanks for that. On 6/17/2021 5:08 AM, Jean SUZINEAU via fpc-pascal wrote: 10 kb of Powerbasic ... you're cheating, it's pascal here ;-) You can do this with just 1kb of

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

2021-06-17 Thread Marco van de Voort via fpc-pascal
Op 2021-06-16 om 23:49 schreef Jean SUZINEAU via fpc-pascal: My best score is 67 kb after strip -s with the code below ... ;-) The fact that you use "result" for function result indicates that you use a object pascal mode,  and not the default. If you don't do that (compile in the default

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

2021-06-17 Thread Tomas Hajny via fpc-pascal
On 2021-06-16 23:49, 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):

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

2021-06-17 Thread Jean SUZINEAU via fpc-pascal
10 kb of Powerbasic ... you're cheating, it's pascal here ;-) You can do this with just 1kb of PowerShell ... ( may be Pascal script could even be shorter ...) File uptime.ps1 : $MethodDefinition = @" [DllImport("kernel32")] public extern static UInt64 GetTickCount64(); "@ $Kernel32 = Add-Type

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

2021-06-16 Thread Travis Siegel via fpc-pascal
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,

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

2021-06-16 Thread Jean SUZINEAU via fpc-pascal
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)

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

2021-06-16 Thread Bart via fpc-pascal
On Wed, Jun 16, 2021 at 5:14 PM Bo Berglund via fpc-pascal wrote: > My use case here is that I created a Windows version of Linux "uptime" by > starting in Lazarus with a new Project and selecting Program. Choose Simple Program from that dialog. No uses clause at all, so everything you need,

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

2021-06-16 Thread Sven Barth via fpc-pascal
Bo Berglund via fpc-pascal schrieb am Mi., 16. Juni 2021, 13:32: > On Wed, 16 Jun 2021 12:30:55 +0200, Mattias Gaertner via fpc-pascal > wrote: > > >> Since the final binary size after using strip -s on the exe file is > >> 271 kb it seems a bit big! > >> Or is there a lot behind the scenes I

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

2021-06-16 Thread Bo Berglund via fpc-pascal
On Wed, 16 Jun 2021 12:30:55 +0200, Mattias Gaertner via fpc-pascal wrote: >> Since the final binary size after using strip -s on the exe file is >> 271 kb it seems a bit big! >> Or is there a lot behind the scenes I have missed? > >Classes is a hog. > I commented it away ane recompiled. Worked

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

2021-06-16 Thread LacaK via fpc-pascal
Since the final binary size after using strip -s on the exe file is 271 kb it seems a bit big! Or is there a lot behind the scenes I have missed? Classes is a hog. I had a look, and only tthreadlist (and with that tlist) were instantiated in the startupcode. There are also global variables,

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

2021-06-16 Thread Marco van de Voort via fpc-pascal
Op 2021-06-16 om 12:30 schreef Mattias Gaertner via fpc-pascal: Since the final binary size after using strip -s on the exe file is 271 kb it seems a bit big! Or is there a lot behind the scenes I have missed? Classes is a hog. I had a look, and only tthreadlist (and with that tlist) were

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

2021-06-16 Thread Michael Van Canneyt via fpc-pascal
On Wed, 16 Jun 2021, Bo Berglund via fpc-pascal wrote: I had to add SysUtils to make it work but Lazarus put Classes in there by itself. Since the final binary size after using strip -s on the exe file is 271 kb it seems a bit big! Or is there a lot behind the scenes I have missed? I see

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

2021-06-16 Thread LacaK via fpc-pascal
Since the final binary size after using strip -s on the exe file is 271 kb it seems a bit big! Or is there a lot behind the scenes I have missed? Classes is a hog. If you want smallest executable size you must get rid of SysUtils also. And you must call platform dependent OS API ... L.

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

2021-06-16 Thread Mattias Gaertner via fpc-pascal
On Wed, 16 Jun 2021 12:26:54 +0200 Bo Berglund via fpc-pascal wrote: > On Wed, 16 Jun 2021 12:08:26 +0200 (CEST), Michael Van Canneyt via > fpc-pascal wrote: > > >FPC/lazarus tell you which units are unused, and in the Lazarus IDE > >you can use the quick actions of the message dialog to

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

2021-06-16 Thread Bo Berglund via fpc-pascal
On Wed, 16 Jun 2021 12:08:26 +0200 (CEST), Michael Van Canneyt via fpc-pascal wrote: >FPC/lazarus tell you which units are unused, and in the Lazarus IDE you can >use the >quick actions of the message dialog to quickly remove all unused units. >I use it all the time. Thanks, I will have a look

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

2021-06-16 Thread Michael Van Canneyt via fpc-pascal
On Wed, 16 Jun 2021, Tomas Hajny via fpc-pascal wrote: On 2021-06-16 11:38, Marco van de Voort via fpc-pascal wrote: Op 2021-06-16 om 11:21 schreef Tomas Hajny via fpc-pascal:  Or if they contain $R inclusions. ...or many other things which may not be smartlinked, either because it is not

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

2021-06-16 Thread Tomas Hajny via fpc-pascal
On 2021-06-16 11:38, Marco van de Voort via fpc-pascal wrote: Op 2021-06-16 om 11:21 schreef Tomas Hajny via fpc-pascal:  Or if they contain $R inclusions. ...or many other things which may not be smartlinked, either because it is not possible, or because the compiler and/or linker cannot do

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

2021-06-16 Thread Marco van de Voort via fpc-pascal
Op 2021-06-16 om 11:21 schreef Tomas Hajny via fpc-pascal:  Or if they contain $R inclusions. ...or many other things which may not be smartlinked, either because it is not possible, or because the compiler and/or linker cannot do it right now. Yes. But it is good to keep the things that

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

2021-06-16 Thread Tomas Hajny via fpc-pascal
On 2021-06-16 10:58, Marco van de Voort via fpc-pascal wrote: Op 2021-06-16 om 09:16 schreef Mattias Gaertner via fpc-pascal: On Wed, 16 Jun 2021 08:57:13 +0200 Bo Berglund via fpc-pascal wrote: If I by habit add a bunch of often used units to the uses clause will that affects the size of

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

2021-06-16 Thread Marco van de Voort via fpc-pascal
Op 2021-06-16 om 09:16 schreef Mattias Gaertner via fpc-pascal: On Wed, 16 Jun 2021 08:57:13 +0200 Bo Berglund via fpc-pascal wrote: If I by habit add a bunch of often used units to the uses clause will that affects the size of the compiled application even if they are not in fact used?

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

2021-06-16 Thread Tomas Hajny via fpc-pascal
On 2021-06-16 09:16, Mattias Gaertner via fpc-pascal wrote: On Wed, 16 Jun 2021 08:57:13 +0200 Bo Berglund via fpc-pascal wrote: If I by habit add a bunch of often used units to the uses clause will that affects the size of the compiled application even if they are not in fact used? Yes, if

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

2021-06-16 Thread Mattias Gaertner via fpc-pascal
On Wed, 16 Jun 2021 08:57:13 +0200 Bo Berglund via fpc-pascal wrote: > If I by habit add a bunch of often used units to the uses clause will > that affects the size of the compiled application even if they are > not in fact used? Yes, if they have e.g. initialization sections. Mattias

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

2021-06-16 Thread Bo Berglund via fpc-pascal
If I by habit add a bunch of often used units to the uses clause will that affects the size of the compiled application even if they are not in fact used? I.e. if there are unused units in uses can I shrink the application size by removing them? If so is this the same for GUI and non-GUI