Using existing C code as External Library

Anonymous
2012-11-16
2018-11-08
  • Anonymous - 2012-11-16

    Originally created by: 2fast4u

    My device is a TCP/IP server and I already have the client interface coded in C. I want to connect Codesys systems (e.g. Codesys PLC) as a client and connect with my device over specific port and carry our read write operations.

    One option is to use the NetbaseServices library and connect to the server. But in this case I have to rewrite the entire interface again in IEC (in Codesys). I want to reuse the implementation already available. (We've already rewritten this interface from C# code.)

    After searching this forum, I found at least 10-15 posts regarding the use of External library (ANSI C / C++). Also checked the documents "C_IN_32Bit_E.pdf" and "C_in_CoDeSys_e.pdf". but could not really comprehend how to work with this.

    It seems from the documents that I have to first create the interface in Codesys and then write the C functions. But what if the C code is already available? Do I've to modify the .c or .h files? How will this be linked in the Codesys Project?

    Is there any example code available for use of External C functions?

     
  • TimvH

    TimvH - 2012-11-16

    To do this with V3 you need to have the runtime toolkit and link your external library to the runtime.

     
  • Anonymous - 2018-11-08

    Originally created by: n1849778

    Do I have to pay for the runtime toolkit?

     

Log in to post a comment.