Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Conditional Compilation?

bvanbata
2006-10-05
2008-02-06
  • bvanbata - 2006-10-05

    Hello-

    I am new to CoDeSys, but have experience with other more formal programming languages such as C, C++, etc... I am looking to create an application that will work with more than one type of target. For example, I would like to create a program that will run on at least two specific targets, with minimal intervention. One way to accomplish this with the least amount of effort in other languages is to use an 'ifdef' statement that instructs the compiler to include or ignore certain portions of the code. This way, one application with the proper logic included can be compiled for different targets by simply changing the build options of the project. Can anyone tell me if there is a way to accomplish the same type of thing in CoDeSys? I am using V2.3.6.1.

    -Brian

     
  • Anonymous - 2006-10-12

    Originally created by: Fx64

    Hi,

    Conditional compilation is only possible starting from the new version 3.0 (code only). Perhaps you can page out target specific parts into different libraries ( e.g. for each target, however only usefully for data items like array bounds ).

    regards

     
  • annodomini2 - 2008-01-22

    You can conditional compile using an IF THEN ELSE and a boolean constant as the input.

     
  • Igor Petrov - 2008-02-06

    You could make a few similar POUs for different platforms. Next go to: and exclude superfluous POUs from compilation.

    It is not a problem if the POU uses other target specific POUs – they will exclude from the code automatically because they are not in use.

     
  • Igor Petrov - 2008-02-06

    You could make a few similar POUs for different platforms. Next go to: and exclude superfluous POUs from compilation.

    It is not a problem if the POU uses other target specific POUs – they will exclude from the code automatically because they are not in use.

     

Log in to post a comment.