<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent posts by dclements</title><link>https://forge.codesys.com/u/dclements/</link><description>Recent posts by dclements</description><language>en</language><lastBuildDate>Tue, 01 Sep 2026 14:15:28 -0000</lastBuildDate><atom:link href="https://forge.codesys.com/u/dclements/profile/feed.rss" rel="self" type="application/rss+xml"></atom:link><item><title>Feature Request: Read-Only References / Pointer-to-Const Support</title><link>https://forge.codesys.com/forge/talk/Engineering/thread/c05dce14ca/?limit=25#e534</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;I would like to suggest adding support for persistent read-only references or pointers in CODESYS, similar to a C++ pointer-to-const (const T*).&lt;/p&gt;
&lt;p&gt;For example, something conceptually similar to:&lt;/p&gt;
&lt;p&gt;POINTER TO CONSTANT ST_MyData&lt;br/&gt;
or&lt;br/&gt;
REFERENCE TO CONSTANT ST_MyData&lt;/p&gt;
&lt;p&gt;The important distinction is that the reference itself may still be passed around or reassigned, but the referenced object cannot be modified through that reference.&lt;/p&gt;
&lt;p&gt;CODESYS currently supports VAR_IN_OUT CONSTANT, which provides read-only reference semantics for parameters, but there does not appear to be an equivalent type that can be stored in a variable or returned from a method.&lt;/p&gt;
&lt;p&gt;A practical use case is a registry that owns long-lived definitions.&lt;/p&gt;
&lt;p&gt;The registry needs to retain ownership of the data while downstream systems maintain persistent references to it.&lt;/p&gt;
&lt;p&gt;Currently, the main options are:&lt;/p&gt;
&lt;p&gt;Return the struct by value, which loses reference semantics and requires a copy.&lt;br/&gt;
Return POINTER TO ST_Definition, which allows consumers to modify registry-owned data.&lt;br/&gt;
Convert the structure into a Function Block and expose a getter-only interface, which provides the desired encapsulation but introduces more complexity and memory overhead.&lt;/p&gt;
&lt;p&gt;A read-only reference/pointer type would allow libraries to expose persistent, zero-copy access to internally owned data while preserving encapsulation.&lt;/p&gt;
&lt;p&gt;This would be particularly useful for library APIs and object-oriented CODESYS architectures where ownership of data should remain with one component while other components are allowed to observe it.&lt;/p&gt;
&lt;p&gt;Similar requests for constant references/pointers have been discussed on CODESYS Forge previously, so this appears to be a recurring use case rather than something specific to one application.&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">dclements</dc:creator><pubDate>Tue, 01 Sep 2026 14:15:28 -0000</pubDate><guid isPermaLink="false">https://forge.codesys.comd0d94c34af192e7c1cd31520c435361e5d4df751</guid></item></channel></rss>