tomas.krajcar - 2018-02-21

Hi is there some possibility to skip some part in code during compiling code. Based on if with Constant value?
Something like this in C#. I've found pragmas in CODESYS, but my idea is that based on constant value will be called certain lines of code.

C#
\#if DEBUG
Β  Β  Console.WriteLine("Debug version");
\#endif
Possibility in CODESYS?
VAR
Β  Β diNumber: INT;
END_VAR
VAR CONSTANT
Β  Β iDebug:INT:=1;
END_VAR
//in case that iDebug is 2 whole code is skipped in compilation
{IF hasvalue(iDebug,1)}
(*Β  the following code is only processed in App1 *)
{info 'value is 1'}
getnumberofadapters(ADR(diNumber));
y := 1;
{ELSIF hasvalue(iDebug,2)}
(*Β  the following code is only processed in App2 *)
{info 'value is 2'}
y := 2;
{ELSE}
{info 'value is none'}
y := 3;
{END_IF}

Reason why I'm asking is that in some PLC is unsupported some library and I want to avoid error during download such as unresolved reference to getnumberofadapters