PB4 beta11 - Linking unused procedures to exe

Everything else that doesn't fall into one of the other PB categories.
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

PB4 beta11 - Linking unused procedures to exe

Post by va!n »

i think i have read somewhere that PB4 will automatical check what procedures are used and checking what procedures are not used. It would be great, if PureBasic (also the compiler) will do a precompilation of the main source (including all include files) and check if there are any unused procedures to cut them out, before compiling to an executeable!

i have tested it following small source and showing cutting off unused procedures isnt supported or does not work :cry:

A feature like this would be very usefull, because i have some include files and its sad to compile the complete includefile to the exe, when using only one small procedure from it!

Code: Select all

Procedure Temp1()
  UseJPEGImageDecoder()
  UseJPEGImageEncoder()
EndProcedure

Procedure Temp2()
  UsePNGImageDecoder()
  UsePNGImageEncoder()
EndProcedure

Procedure Temp3()
  UseTGAImageDecoder()
  UseTIFFImageDecoder()
EndProcedure

Procedure Test()
  MessageRequester("Procedure Compiling Test","Linking unused Procedures?",0)
EndProcedure

Test()
End
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Actually, the procedures themselves aren't in the final executable even though the image decoders are. :?: Just look at the generated assembly code.

In this case, however, it seems like both procedures are in the final executable:

Code: Select all

Declare Temp1()
Declare Temp2()

Procedure Temp1()
  Temp2()
EndProcedure

Procedure Temp2()
  Temp1()
EndProcedure


User avatar
Rescator
Addict
Addict
Posts: 1769
Joined: Sat Feb 19, 2005 5:05 pm
Location: Norway

Post by Rescator »

va!n the best way to do this would be to use compiler if's and compiler conditions to check and include the image decoder if it has not been included before.
This should reduce such issues!
Post Reply