Conditional IncBin

BlitzMax Forums/BlitzMax Programming/Conditional IncBin

Eikon(Posted 2006) [#1]
I'm trying to turn IncBin support on/off in my program to avoid the long compile times until I'm building to release, but the problem is that putting IncBin commands in a function, regardless of whether it gets called or not, results in the media being included with the exe.

Ex:
Global buildMode = 1, buildStr$ ' 1 = Dev | 2 = Release
If buildMode = 2 Then buildStr$ = "incbin::"

If buildMode = 2 Then IncludeBin

Global img = LoadImage(buildStr$ + "gfx/img.png")

Function IncludeBin()

Print "hit"
IncBin "gfx/img.png"

End Function
Switching the buildMode doesn't stop the image from being included, the only way to do so is to comment out the function altogether. It's odd because "hit" never gets printed either, even though the IncBin command is being called somehow. Is there a way to do this?


N(Posted 2006) [#2]
This is why I've been asked for ?Release alongside ?Debug. The powers that be have seen it unneccessary, apparently.


Mystik(Posted 2006) [#3]
I would also be handy for making demo/full builds.

Steve


*(Posted 2006) [#4]
gets my vote, the demo version idea would be brilliant :D


Azathoth(Posted 2006) [#5]
Didn't the other blitzbasics let you do conditional compilation if it was a constant being compared?
Does Blitzmax do this?
Like:
If someconstant
  stuff ; only include if true
EndIf



Dreamora(Posted 2006) [#6]
I think so but the existance of ?debug gives some unsureness.

Additional flags could be programmed by users themselfs, in src/bmk you find the BMK which does read and parse this precompiler commands.


Azathoth(Posted 2006) [#7]
I think these should be included
?if
?else
?elseif


N(Posted 2006) [#8]
Azathoth: You forgot
-?Define
-?Undefine
-?EndIf

I want macros, damnit.


Azathoth(Posted 2006) [#9]
Yea, macros would be good; though I was really talking about using constants.
Is '?EndIf' need? doesn't just '?' on its own terminate the conditional compilation block?


N(Posted 2006) [#10]
Nope, gotta have ?Endif so it doesn't close, say, another scope.


Azathoth(Posted 2006) [#11]
Oh ok