Can external C function fill structure declared in CoDeSys?

Dubravko
2012-09-12
2012-09-16
  • Dubravko - 2012-09-12

    Hello,

    I have a question regarding functions that return structures and that are located in external library which is part of RTS.

    Let's say that I have a function named Dummy that's part of the RTS and looks like this:

    StructureType*Β  Β Dummy ( StructureType*Β  DataToBeLoaded){
    // code, code, code, loading, loading loading the structure
    return DataToBeLoaded;
    }
    

    I defined an external library in CoDeSys like this:

    FUNCTION Dummy: POINTER TO ARRAY[1..ArrayLength] OF StructureType
    VAR_INPUT
    Β  Β DataToBeLoaded:Β  Β  POINTER TO ARRAY[1..ArrayLength] OF StructureType;
    END_VAR
    

    The main task of this function is to take structure from CoDeSys and load it with data from file. I'm using C lib, because it is easier to manipulate complex text file, like the one I'm dealing with.

    Problem is that is not loaded with any data.

    At the same time I see that function is being exectued and the structure inside of the function is being filled properly (I see it over Telnet).

    Does anyone have some idea how to handle this?

    Thanks in advance.

     
  • shooter - 2012-09-16

    In version 2 not possible, in version 3 it is.

     

Log in to post a comment.