<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Can external C function fill structure declared in CoDeSys?</title><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/72632fa455/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/72632fa455/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/CODESYS-V2/thread/72632fa455/</id><updated>2020-02-27T21:54:40.719000Z</updated><subtitle>Recent posts to Can external C function fill structure declared in CoDeSys?</subtitle><entry><title>Can external C function fill structure declared in CoDeSys?</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/72632fa455/?limit=25#b4fd" rel="alternate"/><published>2020-02-27T21:54:40.719000Z</published><updated>2020-02-27T21:54:40.719000Z</updated><author><name>shooter</name><uri>https://forge.codesys.com/u/shooter/</uri></author><id>https://forge.codesys.combfbfce9c4d77d388d8970302d898c0bcda03e495</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;In version 2 not possible, in version 3 it is.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Can external C function fill structure declared in CoDeSys?</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/72632fa455/?limit=25#3126" rel="alternate"/><published>2020-02-27T21:54:39.036000Z</published><updated>2020-02-27T21:54:39.036000Z</updated><author><name>Dubravko</name><uri>https://forge.codesys.com/u/dubravko/</uri></author><id>https://forge.codesys.comefab8dca3155d00144e99dc8e53b78a1c57a0ae5</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I have a question regarding functions that return structures and that are located in external library which is part of RTS.&lt;/p&gt;
&lt;p&gt;Let's say that I have a function named Dummy that's part of the RTS and looks like this:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;StructureType&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="n"&gt;Dummy&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="n"&gt;StructureType&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="n"&gt;DataToBeLoaded&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
&lt;span class="sr"&gt;//&lt;/span&gt; &lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;loading&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;loading&lt;/span&gt; &lt;span class="n"&gt;loading&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;structure&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;DataToBeLoaded&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;I defined an external library in CoDeSys like this:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nt"&gt;FUNCTION&lt;/span&gt; &lt;span class="nt"&gt;Dummy&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;POINTER&lt;/span&gt; &lt;span class="nt"&gt;TO&lt;/span&gt; &lt;span class="nt"&gt;ARRAY&lt;/span&gt;&lt;span class="cp"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="bp"&gt;..&lt;/span&gt;&lt;span class="nx nx-Member"&gt;ArrayLength&lt;/span&gt;&lt;span class="cp"&gt;]&lt;/span&gt; &lt;span class="nt"&gt;OF&lt;/span&gt; &lt;span class="nt"&gt;StructureType&lt;/span&gt;
&lt;span class="nt"&gt;VAR_INPUT&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="nt"&gt;DataToBeLoaded&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="nt"&gt;POINTER&lt;/span&gt; &lt;span class="nt"&gt;TO&lt;/span&gt; &lt;span class="nt"&gt;ARRAY&lt;/span&gt;&lt;span class="cp"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="bp"&gt;..&lt;/span&gt;&lt;span class="nx nx-Member"&gt;ArrayLength&lt;/span&gt;&lt;span class="cp"&gt;]&lt;/span&gt; &lt;span class="nt"&gt;OF&lt;/span&gt; &lt;span class="nt"&gt;StructureType&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;END_VAR&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;Problem is that  is not loaded with any data. &lt;/p&gt;
&lt;p&gt;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).&lt;/p&gt;
&lt;p&gt;Does anyone have some idea how to handle this?&lt;/p&gt;
&lt;p&gt;Thanks in advance.&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>