Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

DEFINE/#ifdef seems to be ignored in X# 20 Feb 2023 10:46 #25316

  • stefan.ungemach
  • stefan.ungemach's Avatar
  • Topic Author


  • Posts: 14
  • 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

    Please Log in or Create an account to join the conversation.

    DEFINE/#ifdef seems to be ignored in X# 20 Feb 2023 10:53 #25318

    • robert
    • robert's Avatar


  • Posts: 3599
  • 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
    XSharp Development Team
    The Netherlands

    Please Log in or Create an account to join the conversation.

    DEFINE/#ifdef seems to be ignored in X# 20 Feb 2023 10:55 #25321

    • stefan.ungemach
    • stefan.ungemach's Avatar
    • Topic Author


  • Posts: 14
  • Robert,

    dank je wel!

    Please Log in or Create an account to join the conversation.

    DEFINE/#ifdef seems to be ignored in X# 22 Feb 2023 14:47 #25348

    • stefan.ungemach
    • stefan.ungemach's Avatar
    • Topic Author


  • Posts: 14
  • 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.

    Please Log in or Create an account to join the conversation.

    DEFINE/#ifdef seems to be ignored in X# 22 Feb 2023 15:05 #25350

    • robert
    • robert's Avatar


  • Posts: 3599
  • 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
    XSharp Development Team
    The Netherlands

    Please Log in or Create an account to join the conversation.

    Last edit: by robert.
    • Page:
    • 1