Library parameters and conditional compilation

Strucc
2012-11-11
2017-12-25
  • Strucc - 2012-11-11

    I'm developing a library to communicate with special devices over TCP/IP or Serial port.

    First, There are some library parameters - for example RECVBUF_SIZE. I added a parameter list to the library, and added this as constant. It appears nice in the library manager of the application, I can see the parameter, the default value and the comment, but it's not editable (even if the column heading claims "Value (editable)"). What did I do wrong?

    Second:
    Is there a way to do conditional compilation of a library, based on a given parameter or some kind of global "define"?
    For example debug logging code should be excluded by default for performance reasons... Where can I put defines in an application that are available while compiling libraries?

    Third:
    Is there a list somewhere describing internal defines? For example can I build part of the code (library) if dynamic memory allocation is enabled?

    Thanks for your help in advance,
    P.Peter

     
  • TimvH

    TimvH - 2012-11-13

    You can edit the parameters, but sometimes it doesn't seem possible.
    Just select the line which you want to edit and press the "space bar". Also by several clicks you can edit it.

    In the properties of the application (right click on Application) you have a Tab "Build". Here you can enter your compiler defines. See the help of CODESYS for all conditional compile pragma's. (I am not sure if this also works for compiling libraries linked to your project, but I hope you can share your experience here).

     
  • Strucc - 2012-11-13

    TimvH hat geschrieben:
    You can edit the parameters, but sometimes it doesn't seem possible.
    Just select the line which you want to edit and press the "space bar". Also by several clicks you can edit it.

    What a trick I don't really know if it's a security feature or a bug
    ... it helped, thanks...

    TimvH hat geschrieben:
    In the properties of the application (right click on Application) you have a Tab "Build". Here you can enter your compiler defines. See the help of CODESYS for all conditional compile pragma's. (I am not sure if this also works for compiling libraries linked to your project, but I hope you can share your experience here).

    I have checked that, works fine for items in the application tree. However, it does not influence the compilation of items in the POUs part. This behavior is documented in the help:

    However, it's a very boring limitation, I think the main use of conditional defines is to prepare the code for different applications, devices... This limitation contradicts that objective.

    As a library is a collection of POUs, it seems that there is no way to influence the build of libraries in an application specific manner... I tried to insert a library in the application tree, but it did not handle the define from the application settings.

    Is there other global place to add project related defines? (defines, that POUs can use... projectwide)

    Or are there other ideas?

     
  • r.zarei2010 - 2017-12-25

    Did you have found any solution for this?

    Strucc hat geschrieben:
    What a trick I don't really know if it's a security feature or a bug
    ... it helped, thanks...
    I have checked that, works fine for items in the application tree. However, it does not influence the compilation of items in the POUs part. This behavior is documented in the help:
    However, it's a very boring limitation, I think the main use of conditional defines is to prepare the code for different applications, devices... This limitation contradicts that objective.
    As a library is a collection of POUs, it seems that there is no way to influence the build of libraries in an application specific manner... I tried to insert a library in the , but it did not handle the define from the application settings.
    Is there other global place to add project related defines? (defines, that POUs can use... projectwide)
    Or are there other ideas?

     

Log in to post a comment.