Wish #ifdef - #else - #endif

Robert Valentino

Well-Known Member
Licensed User
Longtime User
I am nearing the end of a project I have been working on and now have the task of how to handle multiple versions a Trial / Free version and a paying version.

It sure would be nice if the B4A development IDE allowed us to have #ifdef so we could define a global variable to the compiler and then use it to test what code to compile.


#ifdef _TRAIL_OR_TEST_VERSION <-- Would be defined somewhere in the IDE interface
... compile this code
#else
... compile this code
#endif

I do this in Visual Studio all the time
#ifdef _DEBUG
.. If compiling in Debug Mode include this code
#endif


I think this is something that Erel could add pretty easily - I noticed the compiler when generating the java code dumps all the comments I put in my code, so why can we not dump or include all the code in a #ifdef


Just a thought to make supporting multiple version easier.

BobVal
 

DonManfred

Expert
Licensed User
Longtime User
There is no such function in B4A but you can use this Tool from @MaFu .
 

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Yes I understand B4A does not support this, that is why I put it on the Wish List.

Your tool looks very interesting but I believe we need something directly supported by B4A

Thanks
 

DonManfred

Expert
Licensed User
Longtime User
Yes I understand B4A does not support this, that is why I put it on the Wish List.
Your tool looks very interesting but I believe we need something directly supported by B4A

It´s not my tool.
I understand that you want this feature in b4a directly built-in. I´m with you :)
 

daemon

Active Member
Licensed User
Longtime User
@Erel
Bumping it up for v4.00
In 3.82, #If and #End If are supported but #Else or #Else If are not. Please support them in v4.
 

derez

Expert
Licensed User
Longtime User
Reminding that the "build configurations" enable you to do it.
 

daemon

Active Member
Licensed User
Longtime User
Yes, but when you have multiple such macros, number of build configuration increases exponentially!
 
Top