Page 1 of 1

Compiler creates executable with different filesize

Posted: Fri Jan 24, 2014 12:30 pm
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

Re: Compiler creates executable with different filesize

Posted: Fri Jan 24, 2014 1:51 pm
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

Re: Compiler creates executable with different filesize

Posted: Fri Jan 24, 2014 2:22 pm
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

Re: Compiler creates executable with different filesize

Posted: Fri Jan 24, 2014 2:26 pm
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.

Re: Compiler creates executable with different filesize

Posted: Fri Jan 24, 2014 2:47 pm
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