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

Deploy an external library to CODESYS Control RTE v3

2013-04-02
2017-02-16
  • SimonPeckmore - 2013-04-02

    Hi there,

    I'm brand new to CODESYS (and IEC 61131 in general) and have been given a research assignment to bring me up to speed with a project currently in progress at work. I'm trying to investigate deploying an application to a CODESYS Control RTE v3 runtime that contains a function defined in a C library.

    So far I have:

    Following the documentation, my two CODESYS projects appear to be working correctly - the base project successfully calls the library project and, when attempting to download the project to my RTE target, I receive the "1 unresolved reference" error as expected. I'm now not sure how to proceed in deploying the C library to the target device so that the reference can be resolved.

    If I remove the reference to the library project from my base project (and update the code accordingly) I can successfully download and run the project on the RTE target, so I am at least confident that aspect is working.

    If anyone would anyone be able to offer any assistance with this or point me in the right direction it would be greatly appreciated.

     
  • TimvH

    TimvH - 2013-05-12

    You need the runtime toolkit to be able to extend the RTE with additional external libraries.
    Please contact 3S-Smart Software Solutions or your local distributor for this toolkit.

     
  • SimonPeckmore - 2013-05-29

    TimvH, many thanks for your response.

    I wanted to post an update with information I found regarding this in case it was of use to anyone else attempting to do the same. After contact with 3S it turns out that external libraries (DLLs containing C functions) can only be used with CODESYS Control WIN, and not with CODESYS Control RTE.

    In order to make use of C functions with RTE you have to compile your code into a Windows kernel-mode driver which is then loaded by the RTE run-time - the resulting file for RTE would be a .SYS file when compiled, not a .DLL file. You can then implement functions in CODESYS and mark them as "External" and the corresponding functions within the loaded kernel-mode drivers will be called.

    I've attached the only official documentation I could find on this topic but it doesn't cover the entire process and there are aspects missing. If anyone wants it, if it's OK with 3S, and if I can clear it with my employer, I may also be able to post a sample project that builds and can be used by RTE. I would have to remove certain files which are supplied by 3S as part of their runtime toolkit, but I can leave the directory structure in place so, once these files are obtained from 3S, they can be added to the project as required.

    Creating own Runtime System Components and IO Drivers (v2.0).pdf [194.06 KiB]

    Creating and Linking External C Library Functions (v1.0).pdf [176.38 KiB]

     
  • bacha.damin - 2017-02-16

    hi

    I like to add an external library to CODESYS Control RTE v3 but I always find this problem

    IMG: Sans titre.png

     

Log in to post a comment.