Unneeded data in executable?

Everything else that doesn't fall into one of the other PB categories.
User avatar
Piero
Addict
Addict
Posts: 862
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Unneeded data in executable?

Post 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
infratec
Always Here
Always Here
Posts: 7575
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Unneeded data in executable?

Post 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?
User avatar
Piero
Addict
Addict
Posts: 862
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Re: Unneeded data in executable?

Post 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:
Last edited by Piero on Mon Apr 28, 2025 12:26 pm, edited 1 time in total.
BarryG
Addict
Addict
Posts: 4121
Joined: Thu Apr 18, 2019 8:17 am

Re: Unneeded data in executable?

Post 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.
User avatar
Piero
Addict
Addict
Posts: 862
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Re: Unneeded data in executable?

Post 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)
Last edited by Piero on Mon Apr 28, 2025 11:48 am, edited 1 time in total.
infratec
Always Here
Always Here
Posts: 7575
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Unneeded data in executable?

Post 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.
BarryG
Addict
Addict
Posts: 4121
Joined: Thu Apr 18, 2019 8:17 am

Re: Unneeded data in executable?

Post by BarryG »

I'm on 6.10 still.
Quin
Addict
Addict
Posts: 1122
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

Re: Unneeded data in executable?

Post 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.
User avatar
Piero
Addict
Addict
Posts: 862
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Re: Unneeded data in executable?

Post by Piero »

Quin wrote: Mon Apr 28, 2025 3:01 pmWhen 6.20 stable drops
6.21 :x
User avatar
Mindphazer
Enthusiast
Enthusiast
Posts: 456
Joined: Mon Sep 10, 2012 10:41 am
Location: Savoie

Re: Unneeded data in executable?

Post 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
MacBook Pro 16" M4 Pro - 24 Gb - MacOS 15.4.1 - Iphone 15 Pro Max - iPad at home
...and unfortunately... Windows at work...
Quin
Addict
Addict
Posts: 1122
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

Re: Unneeded data in executable?

Post 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:
User avatar
NicTheQuick
Addict
Addict
Posts: 1502
Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:

Re: Unneeded data in executable?

Post 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.
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
User avatar
DeanH
Enthusiast
Enthusiast
Posts: 274
Joined: Wed May 07, 2008 4:57 am
Location: Adelaide, South Australia
Contact:

Re: Unneeded data in executable?

Post 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.
User avatar
Piero
Addict
Addict
Posts: 862
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Unicode strings in executable

Post 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
Quin
Addict
Addict
Posts: 1122
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

Re: Unicode strings in executable

Post 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
Post Reply