Hi
I have a dummie question: Is the compiler optimised that not used functions are not in the compiled program?
Why I ask: I made some sub source files with global handling functions and bind them in my program source with XIncludeFile. When I make a program with much of all functions the compiled file size is nearly same as a program with only one function of that used (PB3.94).
Or should I use an other way to do that?
But I do not want DLLs or separate files to handle.
Many thanks for your help.
SKER
compiler uses only used functions ?
No, the PB4 changelog says, that procedures who are used will be compiled.
I asked this a long time ago, and I made a test:Write this without calling the procedure and you see: the EXE is bigger than a EXE without any code 
I asked this a long time ago, and I made a test:
Code: Select all
Procedure AND51()
; Code, and what eveer you want
EndProcedure

PB 4.30
Code: Select all
onErrorGoto(?Fred)
Nope. Non used functions are not included. But if u use strings they are.
Just try it.
Do u find any "Test" in the exe?
Just try it.
Code: Select all
procedure Test()
Me.l='tseT'
endprocedure
Apart from that Mrs Lincoln, how was the show?
-
- Enthusiast
- Posts: 468
- Joined: Sat Dec 20, 2003 6:19 pm
- Location: Switzerland
This compiler feature is very restricted (reason: I think the speed of the
compiler).
won't be included, but
there both procedures will be included. The feature only works if there is
NO (not a single) reference to the procedure in the code, even if this
reference is in another not used procedure, the procedure will be included.
So: Mostly, from a bit more complex function libraries most of the functions
will be included.
compiler).
Code: Select all
procedure test()
a+4
procedurereturn a
endprocedure
Code: Select all
procedure test1()
a+4
if a = 5
test2()
endif
procedurereturn a
endprocedure
procedure test2()
test1()
endprocedure
NO (not a single) reference to the procedure in the code, even if this
reference is in another not used procedure, the procedure will be included.
So: Mostly, from a bit more complex function libraries most of the functions
will be included.
Athlon64 3700+, 1024MB Ram, Radeon X1600
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Another possibility is to use a user library instead of an include.
AFAIK, only used userlib functions are included.
AFAIK, only used userlib functions are included.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).