xsharp.eu • DEFINE/#ifdef seems to be ignored in X#
Page 1 of 1

DEFINE/#ifdef seems to be ignored in X#

Posted: Mon Feb 20, 2023 9:46 am
by stefan.ungemach
Can anyone please explain to me why the folliwing code considers DUMMY_DEFINE to be not set (thus greying out anything except the red line which becomes compiled)? Playing around with the -/vo8 switch didn't change the behaviour.

define DUMMY_DEFINE := true
FUNCTION Start() AS VOID STRICT

#ifdef DUMMY_DEFINE
SafeDebOut32( "DUMMY_DEFINE true")
#else
SafeDebOut32( "DUMMY_DEFINE false")
#endif

DEFINE/#ifdef seems to be ignored in X#

Posted: Mon Feb 20, 2023 9:53 am
by robert
Stefan,
If you want to use the #ifdef functionality in X# you will need to use #define to declare the values and not define.
And /vo8 controls the case sensitivity of the preprocessor w.r.t. symbols declared with #define and not those declared with define.


Robert

DEFINE/#ifdef seems to be ignored in X#

Posted: Mon Feb 20, 2023 9:55 am
by stefan.ungemach
Robert,

dank je wel!

DEFINE/#ifdef seems to be ignored in X#

Posted: Wed Feb 22, 2023 1:47 pm
by stefan.ungemach
There seems to be another issue. The scope of #DEFINE is limited to its prg. In VO it's not, so you cal set a switch for a whole app at one single point. Thus, a global compiler switch in former VO code works no more and requires deep analysis of all the transported code in all PRGs which is a dangeroius error source.

DEFINE/#ifdef seems to be ignored in X#

Posted: Wed Feb 22, 2023 2:05 pm
by robert
Stefan,

You can define global defines on the Build page of the project properties.
We are following the model here from all other languages. VO was really the exception.

Robert

Re: DEFINE/#ifdef seems to be ignored in X#

Posted: Mon Jul 08, 2024 3:44 pm
by Kees Bouw
robert wrote: Wed Feb 22, 2023 2:05 pm Stefan,

You can define global defines on the Build page of the project properties.
We are following the model here from all other languages. VO was really the exception.

Robert
Sorry for my ignorance but where exactly on the Build page can you define a global define and what is the syntax? I searched the documentation but could not find it.

Thank you,

Kees.

Re: DEFINE/#ifdef seems to be ignored in X#

Posted: Mon Jul 08, 2024 4:05 pm
by robert
Kees,
https://www.xsharp.eu/help/proppage-build.html
Defines for the preprocessor

Robert

Re: DEFINE/#ifdef seems to be ignored in X#

Posted: Tue Jul 09, 2024 10:04 am
by Kees Bouw
robert wrote: Mon Jul 08, 2024 4:05 pm Kees,
https://www.xsharp.eu/help/proppage-build.html
Defines for the preprocessor

Robert
Robert,

As I said... sorry for my ignorance. I did not even know about https://www.xsharp.eu/help, I thought the online help was at https://docs.xsharp.it.

I am very happy with this link, it answers a lot of questions!

Kees.

Re: DEFINE/#ifdef seems to be ignored in X#

Posted: Tue Jul 09, 2024 10:23 am
by robert
Kees,

This online help is the same (based on the same help source) as the help that is included in the installer,which for example is also available from the VS Help menu.

Robert