Page 1 of 2

Unneeded data in executable?

Posted: Mon Apr 28, 2025 11:15 am
by Piero
Why does this also work in executable?!?!?!? :shock:

Code: Select all

MessageRequester("compiler file",#PB_Compiler_File)
PS: Found trying to answer this rndrei thread

Re: Unneeded data in executable?

Posted: Mon Apr 28, 2025 11:24 am
by infratec
Why not :?: :?: :?: :?: :?: :?:

To build the executable, the file is compiled and during this, the constant is replaced by the filename.

You can use this and #PB_Compiler_Line for writing better log files.
So ... this constants are needed in an executable if they are used.

What do you expect? An empty string? Not showing the MessageRequester?

Re: Unneeded data in executable?

Posted: Mon Apr 28, 2025 11:29 am
by Piero
infratec wrote: Mon Apr 28, 2025 11:24 am Why not :?: :?: :?: :?: :?: :?:
To build the executable, the file is compiled and during this, the constant is replaced by the filename.
You can use this and #PB_Compiler_Line for writing better log files.
Wait; I must being misunderstanding something: why does the executable need to contain that info?
Also, I cannot find it searching the binary!

Edit: "I must being misunderstanding something" :oops: :oops: :oops:

Re: Unneeded data in executable?

Posted: Mon Apr 28, 2025 11:34 am
by BarryG
Piero wrote: Mon Apr 28, 2025 11:29 amwhy does the executable need to contain that info?
Because you told it to. The constant is replaced by its name, as expected.

The real question is why a single MessageRequester compiles an executable of 487 KB. :( So much added extra info. Surely PureBasic can go back to the good old days where a MessageRequester executable was only 6 KB (using PureBasic 5.73). That's the version I use for my own little tools now.

Re: Unneeded data in executable?

Posted: Mon Apr 28, 2025 11:37 am
by Piero
BarryG wrote: Mon Apr 28, 2025 11:34 am
Piero wrote: Mon Apr 28, 2025 11:29 amwhy does the executable need to contain that info?
Because you told it to. The constant is replaced by its name, as expected.

The real question is why a single MessageRequester compiles an executable of 487 KB. :( So much added extra info. Surely PureBasic can go back to the good old days where a MessageRequester executable was only 6 KB (using PureBasic 5.73). That's the version I use for my own little tools now.
Thank you!
My Fault :oops: :oops: :oops:

PS: I was alarmed because I couldn't find it into the binary (probably because of unicode)

Re: Unneeded data in executable?

Posted: Mon Apr 28, 2025 11:47 am
by infratec
BarryG wrote: Mon Apr 28, 2025 11:34 am The real question is why a single MessageRequester compiles an executable of 487 KB. :( So much added extra info. Surely PureBasic can go back to the good old days where a MessageRequester executable was only 6 KB (using PureBasic 5.73). That's the version I use for my own little tools now.
Hm...

with PB 6.21b5 x86 asm backend on Win 10 x64 it generates an exe with 119.808 bytes
And if I check the compiler option 'Use shared UCRT' the exe is 17.920 bytes.

Re: Unneeded data in executable?

Posted: Mon Apr 28, 2025 12:28 pm
by BarryG
I'm on 6.10 still.

Re: Unneeded data in executable?

Posted: Mon Apr 28, 2025 3:01 pm
by Quin
BarryG wrote: Mon Apr 28, 2025 12:28 pm I'm on 6.10 still.
When 6.20 stable drops I highly recommend checking it out, as long as you're okay with your apps being stuck to Windows 10 and above when you check this box, the UCRT will give you binaries like the days of PB before the new toolchain. And, if you want to support older OSs, just uncheck it and rebuild! :D PureBasic is beautiful.

Re: Unneeded data in executable?

Posted: Mon Apr 28, 2025 3:13 pm
by Piero
Quin wrote: Mon Apr 28, 2025 3:01 pmWhen 6.20 stable drops
6.21 :x

Re: Unneeded data in executable?

Posted: Mon Apr 28, 2025 3:21 pm
by Mindphazer
BarryG wrote: Mon Apr 28, 2025 11:34 am The real question is why a single MessageRequester compiles an executable of 487 KB. :( So much added extra info. Surely PureBasic can go back to the good old days where a MessageRequester executable was only 6 KB (using PureBasic 5.73). That's the version I use for my own little tools now.
It also depends on the platform : on my Mac, the compiled app's size is 119 Kb

Re: Unneeded data in executable?

Posted: Mon Apr 28, 2025 3:24 pm
by Quin
Piero wrote: Mon Apr 28, 2025 3:13 pm
Quin wrote: Mon Apr 28, 2025 3:01 pmWhen 6.20 stable drops
6.21 :x
One of these days I'll learn to not post before having my coffee :mrgreen:

Re: Unneeded data in executable?

Posted: Mon Apr 28, 2025 4:41 pm
by NicTheQuick
With PureBasic 6.20 (x64) the size is
  • 31288 bytes with the C backend
  • 39432 with the ASM backend
Created on Ubuntu 24.04 LTS.

Re: Unneeded data in executable?

Posted: Tue Apr 29, 2025 5:13 am
by DeanH
I found the UCRT option on 6.21 Beta 6 in the Compiler Options. It reduced the little MessageRequester program from 150k to 24.6k. That's still a fair bit more than the 6k the PB5.3 and 5.7 and even 6.04 generated. I tried it on my own programs. One module went from 8053k to 7729k, another from 9016k to 8692k. It felt as if the exe's seemed to fire up more quickly, too.

I am old school. Efficient programs only contain the code they need.

Unicode strings in executable

Posted: Thu May 01, 2025 12:28 am
by Piero
Piero wrote: Mon Apr 28, 2025 11:37 amI was alarmed because I couldn't find it into the binary
To show unicode strings on binaries you can use stringsext (multi platform)

Example search for the unicode string "Pure" (using grep) into a Mac binary:

Code: Select all

stringsext -e UTF-16le -- /pb.app/Contents/MacOS/pb | grep Pure

Re: Unicode strings in executable

Posted: Thu May 01, 2025 1:17 pm
by Quin
Piero wrote: Thu May 01, 2025 12:28 am
Piero wrote: Mon Apr 28, 2025 11:37 amI was alarmed because I couldn't find it into the binary
To show unicode strings on binaries you can use stringsext (multi platform)

Example search for the unicode string "Pure" (using grep) into a Mac binary:

Code: Select all

stringsext -e UTF-16le -- /pb.app/Contents/MacOS/pb | grep Pure
Is there not strings for Mac?
https://github.com/robpike/strings