<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to VarAccGetAddress does not return the correct address for TYPE_ARRAY or TYPE_USERDEF.</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/33c40f19f2/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/33c40f19f2/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/33c40f19f2/</id><updated>2025-08-28T01:18:45.641000Z</updated><subtitle>Recent posts to VarAccGetAddress does not return the correct address for TYPE_ARRAY or TYPE_USERDEF.</subtitle><entry><title>VarAccGetAddress does not return the correct address for TYPE_ARRAY or TYPE_USERDEF.</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/33c40f19f2/?limit=25#eba7" rel="alternate"/><published>2025-08-28T01:18:45.641000Z</published><updated>2025-08-28T01:18:45.641000Z</updated><author><name>jzhvymetal77</name><uri>https://forge.codesys.com/u/jzhvymetal77/</uri></author><id>https://forge.codesys.com88b6eae55a4670396d7b8b99d92d01e0fa4c36da</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;VarAccGetAddress does not return the correct address for TYPE_ARRAY or TYPE_USERDEF. When you use VarAccGetNode, it returns a proper IBaseTreeNode if you provide the full path of an array element or structure element, and it even provides the correct data type.&lt;/p&gt;
&lt;p&gt;The problem is that with TYPE_ARRAY, it returns the start address of the array rather than the indexed element. With TYPE_USERDEF, it only returns the offset of the element instead of the actual address.&lt;/p&gt;
&lt;p&gt;This causes many issues with nested structures or arrays of structures, since it requires manually calculating the address based on the parent IBaseTreeNode.&lt;/p&gt;
&lt;p&gt;See attached image and example.&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>