Compiler creates executable with different filesize

Everything else that doesn't fall into one of the other PB categories.
Fenix
Enthusiast
Enthusiast
Posts: 102
Joined: Wed May 07, 2003 1:45 am
Location: Germany

Compiler creates executable with different filesize

Post by Fenix »

Hi,

I was interested what the assembler source of my program would look like, so - as I didn't know how to set the /COMMENTED flag in the PB IDE - I compiled the program using the dosbox.

To my surprise the executable was about 12% smaller than the one compiled using the PB IDE (2.114kb [cli] to 2.405kb [PB IDE])? First I thought there might be some icons missing but that wasn't it, the program works fine with no missing parts. Why is that?

The program was compiled with

Code: Select all

pbcompiler source.pb /COMMENTED /CONSTANT PB_Editor_BuildCount=0
and I use the following command sets in the program:

Code: Select all

; The header must remain intact for Re-Assembly
; 
; ToolBar
; Thread
; String
; StatusBar
; Sort
; Requester
; RegularExpression
; Process
; Preference
; OnError
; Music
; Sound
; SoundPlugin
; Menu
; Math
; LinkedList
; Library
; Keyboard
; Mouse
; Screen
; Sprite
; MultiMediaBase
; ImagePluginBMP
; Engine3D
; ImagePluginPNG
; Http
; Network
; Gadget
; System
; Window
; Font
; File
; Event
; Map
; Desktop
; DatabaseSQLite
; FileSystem
; Date
; Database
; Cipher
; Array
; 2DDrawing
; Image
; AlphaImage
; ImagePlugin
; Memory
; Object
; SimpleList
; :System
; ADVAPI32
; COMCTL32
; KERNEL32
; USER32
; :Import
Two other - smaller things:
1) When I tried to compile via cli I got an error message "Constant not found: #PB_Editor_BuildCount". I remember that even in the IDE I had to type it in myself - it wasn't available in the autocomplete.

2) When I tried to add it (using /CONSTANT) I wrote /CONSTANT #PB_Editor_BuildCount the compiler crashed. Removing the "#" and it works fine. Howe come?

Greetz,
Fenix
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: Compiler creates executable with different filesize

Post by srod »

In the IDE do you have any of the compiler options; Unicode, Threadsafe, XP themes, request admin support for Vista and so on?

Some of these will involve the compiler using different routines (e.g. unicode versions of functions). Others will involve the compiler adding various manifests to the exe's resource section etc.

You need to make sure that the compiler switches you give at the command line match exactly those which the IDE will give based upon your settings.

btw, you might want to take a look at : http://www.purebasic.fr/english/viewtop ... tedASM.exe
I may look like a mule, but I'm not a complete ass.
Fenix
Enthusiast
Enthusiast
Posts: 102
Joined: Wed May 07, 2003 1:45 am
Location: Germany

Re: Compiler creates executable with different filesize

Post by Fenix »

srod wrote:In the IDE do you have any of the compiler options; Unicode, Threadsafe, XP themes, request admin support for Vista and so on?
Yes, that's it. Using the settings from the IDE in the CLI produced the same size of the exe.
Thanks srod, again! :D
srod wrote:btw, you might want to take a look at : http://www.purebasic.fr/english/viewtop ... tedASM.exe
Nice, made it's way to my tools menu :wink:

Greetz,
Fenix
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: Compiler creates executable with different filesize

Post by srod »

You'll have to alter the source of the tool and recompile if you want the ASM to reflect Unicode and/or threadsafe etc. As it is it just generates ASM without either of these switches set.
I may look like a mule, but I'm not a complete ass.
Fenix
Enthusiast
Enthusiast
Posts: 102
Joined: Wed May 07, 2003 1:45 am
Location: Germany

Re: Compiler creates executable with different filesize

Post by Fenix »

srod wrote:You'll have to alter the source of the tool and recompile if you want the ASM to reflect Unicode and/or threadsafe etc. As it is it just generates ASM without either of these switches set.
Yup, I added the switches for /unicode and /linenumbering :)

Greetz,
Fenix
Post Reply