Compiler directives in IF statements
MLaletas
Posts: 226
So I guess I am confused with compiler directives, specifically #DEFINE. I have a couple of #DEFINE's in some IF statements and the point is to only define them if a particular variable is true....simple enough. However it seems like at least with #DEFINE's that it runs that line no matter what regardless if it is in an IF statement and regardless if the condition is true or false. Is this correct? I have not done a proof of concept just slimming it down but I am fairly sure that this is happening.
0
Comments
Results:
What are you trying to accomplish?
I think the way you have this coded the DEFINE_ENABLED will always be defined.
The Compiler does not evaluate IF ( nTest ) at Compile time.
Now obviously that will not work, I have to rethink how I am going to approach this.
Of course, this means I can't use display modules... but no real loss there.
So instead of:
You would have:
And so on. For DATA_EVENTS from the devices, you would do something like:
It makes for a bunch of code but makes sense if you have a bunch of identical rooms that vary by display model or type of playback device for instance.
Have a config.axi file with your #define statements:
#define Display_Samsung
#define Bluray_Oppo
#define Switcher_ExtronSIS
etc, etc.....
In your main program file, call this axi file first. Then use compiler directives to instantiate your modules if and only if the specific keyword is defined:
#if_defined Display_Samsung
define_module 'Samsung Display'
#end_if
Hope this helps,
erik