Compilation Directive (Monkey 0.66b)

Monkey Forums/Monkey Programming/Compilation Directive (Monkey 0.66b)

golomp(Posted 2013) [#1]
In Monkey we can use some compilation directive for example:
#If LANG<>"cpp" And LANG<>"java" And LANG<>"cs"
#Error "File streams are not supported on this target"
#Endif

I would like to know if it's possible to declare a variable for example
#define full_version
to implement some block like these
#ifdef full_version
......
#else
.....
#endif

Like this it could be easier to manage a unique source code and obtain directly the appropriate version just with one parameter.
(it's existing in C++, Delphi, etc...)


muddy_shoes(Posted 2013) [#2]
Pretty much. You can create preprocessor values in the same way you can override config values.

[monkeycode]
Import mojo

Function Main:Int()
Local a:App = New App

#FLAG = "False"

#If FLAG = "True"
Print "Flag is True"
#Else
Print "Flag is False"
#End
Return 0
End
[/monkeycode]


golomp(Posted 2013) [#3]
Thank you Muddy_Shoes !