<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Using variable length arrays in libraries</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/e40f2fe915/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/e40f2fe915/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/e40f2fe915/</id><updated>2020-02-27T13:48:39.133000Z</updated><subtitle>Recent posts to Using variable length arrays in libraries</subtitle><entry><title>Using variable length arrays in libraries</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/e40f2fe915/?limit=25#a1df" rel="alternate"/><published>2020-02-27T13:48:39.133000Z</published><updated>2020-02-27T13:48:39.133000Z</updated><author><name>yannickasselin1</name><uri>https://forge.codesys.com/u/yannickasselin1/</uri></author><id>https://forge.codesys.com7d1ccc40884501d1aaf3257265dbb73af3ceb3d7</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I've been having problems with variable arrays.&lt;br/&gt;
I stopped using it and used pointers instead.&lt;br/&gt;
See this post for more information on the problems I had:&lt;br/&gt;
 l &lt;a class="" href="https://forum.codesys.com/viewtopic.php?t=7558&amp;amp;p=17267&amp;amp;lan=en" rel="nofollow"&gt;viewtopic.php?t=7558#p17267&lt;/a&gt; l &lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Using variable length arrays in libraries</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/e40f2fe915/?limit=25#bcf2" rel="alternate"/><published>2020-02-27T13:48:39.058000Z</published><updated>2020-02-27T13:48:39.058000Z</updated><author><name>drgry</name><uri>https://forge.codesys.com/u/drgry/</uri></author><id>https://forge.codesys.com98e71b717fc73889d74d6165d774ffdc44edec3e</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello all,&lt;/p&gt;
&lt;p&gt;I am trying to make a FB in library that uses variable length arrays as input. I am facing some issues I would like to get answers to. I attached .zip of library and test project. From this you can see following:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Codesys online help states that: &lt;strong&gt;CODESYS supports one, two, and three-dimensional arrays of ELEMENTATY data types&lt;/strong&gt;. Contrary to this I am able to define variable length arrays of user defined data type  with 2 REAL elements and to define FB . Code compiles with no error and it is possible to install library in Library repository. There is no documentation generated, but I found explanation to this in forum  . Library has namespace DRGRY.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;For testing two more FB are defined:  with variable length array of Real and  with fixed length array of . Again, code compiles with no error and it is possible to install library in Library repository.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Testing in project: Now the fun begins: When I try to call  in program with  as VAR_IN_OUT parameter compiler gives me error: . Why? I copied this function from library to project with one necessary modification: declaration of input variable is no longer  but . When calling this function with  there is no problem. Code executes just fine on my Beaglebone Black. Only problem is converting  to . For me this means that I can not put function with varianle length array of DUT to library.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Questions:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Despite online help claiming that only variable length arrays of elementary types can be used, it is clear that variable length arrays of DUT can be used when defining FB. Is this legal to do with Codesys?&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;How to make it work with library defined DUT and FB, with regard to errors I am getting? Am I doing something wrong? Is there any settings to do? Is this a system problem?&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I am using latest(?) version of Codesys V3.5 SP10 Patch 4.&lt;/p&gt;
&lt;p&gt;I would appreciate some help and guidelines on this matter.&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;&lt;a class="" href="https://forum.codesys.com//download/file.php?id=2886" rel="nofollow"&gt;ArrayTest.zip &lt;span&gt;&lt;span&gt;[74.12 KiB]&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>