<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Global Variables</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/587bd07ae4/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/587bd07ae4/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/587bd07ae4/</id><updated>2025-04-11T09:43:27.993000Z</updated><subtitle>Recent posts to Global Variables</subtitle><entry><title>Global Variables</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/587bd07ae4/?limit=25#3316" rel="alternate"/><published>2025-04-11T09:43:27.993000Z</published><updated>2025-04-11T09:43:27.993000Z</updated><author><name>bjarne-pagaard</name><uri>https://forge.codesys.com/u/bjarne-pagaard/</uri></author><id>https://forge.codesys.com10ac10c20d9cdcf0a3d109e7d50d1f1c5b4ca76c</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Old thread, I know - but it still has good answers. I would like to add a bit of info to it, as I was having a problem that lead me to this thread, but didn't give an exact answer.&lt;/p&gt;
&lt;p&gt;I am porting a project to a different PLC architecture. (Wago PFC300)&lt;/p&gt;
&lt;p&gt;A GVL named 'GVL' in the POUs section of my project was shadowed by a PLC-specific library in the Application-&amp;gt;Library Manager. So all the existing references in the device specific code to 'GVL.something' would not resolve.&lt;br/&gt;
Right-clicking the GVL in the code and 'Go to definition' would point me to the library in the Application Library Manager. All I had to do from there, was right-click the library, and set the property 'Only allow qualified access to all identifiers' in the library.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Global Variables</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/587bd07ae4/?limit=250#eedc/2065/46b1/da5a/f02a" rel="alternate"/><published>2020-10-22T13:05:06.077000Z</published><updated>2020-10-22T13:05:06.077000Z</updated><author><name>aliazzz</name><uri>https://forge.codesys.com/u/aliazzz/</uri></author><id>https://forge.codesys.comefa8f1c395092e1fb831776a4ff7a0bfa972b2d8</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Naming conventions are always a topic for hot debate, so I won't touch it.&lt;br/&gt;
However, what is very interesting in the Shadowing convention, I think, is this:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Qualified access can also always be used to avoid shadowing rules.&lt;/p&gt;
&lt;p&gt;The name of the global variable list can be used to uniquely access a variable in the list.&lt;br/&gt;
    The name of a library can be used to uniquely access elements in the library.&lt;br/&gt;
    The THIS pointer be used to uniquely access variables in a function block, even if a local variable with the same name exists in a method of the function block.&lt;/p&gt;
&lt;/blockquote&gt;&lt;/div&gt;</summary></entry><entry><title>Global Variables</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/587bd07ae4/?limit=25#eedc/2065/46b1/da5a" rel="alternate"/><published>2020-10-22T10:55:47.945000Z</published><updated>2020-10-22T10:55:47.945000Z</updated><author><name>Gerhard</name><uri>https://forge.codesys.com/u/gerhard/</uri></author><id>https://forge.codesys.com60f5b748ff8a3f7b257c0dbc35f4e96b9104a058</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Yep thats what i meant, altough I never read those shadowing rules before. Interesting :)&lt;/p&gt;
&lt;p&gt;I completely disagree with their recommended naming conventions by the way.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Global Variables</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/587bd07ae4/?limit=250#eedc/2065/46b1" rel="alternate"/><published>2020-10-22T10:12:58.106000Z</published><updated>2020-10-22T10:12:58.106000Z</updated><author><name>aliazzz</name><uri>https://forge.codesys.com/u/aliazzz/</uri></author><id>https://forge.codesys.com6fe5e76d127b2e2f1b7c2df658cca37564dad8f7</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Just an addition on your excellent remark, search for shadowing as this is what you ment I think.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://help.codesys.com/webapp/_cds_shadowing_rules;product=codesys;version=3.5.16.0" rel="nofollow"&gt;https://help.codesys.com/webapp/_cds_shadowing_rules;product=codesys;version=3.5.16.0&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Global Variables</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/587bd07ae4/?limit=25#8314" rel="alternate"/><published>2020-10-22T09:58:45.755000Z</published><updated>2020-10-22T09:58:45.755000Z</updated><author><name>yohay</name><uri>https://forge.codesys.com/u/yohay/</uri></author><id>https://forge.codesys.com86ab43365845c43abbfa44c84ead68c14129f914</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Thank you for this answer!&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Global Variables</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/587bd07ae4/?limit=25#eedc/2065" rel="alternate"/><published>2020-10-22T09:58:22.490000Z</published><updated>2020-10-22T09:58:22.490000Z</updated><author><name>Gerhard</name><uri>https://forge.codesys.com/u/gerhard/</uri></author><id>https://forge.codesys.comffb6827727dbb6ff285441284ce1f4e6407cb06d</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;The qualified_only forces you to indicate which global variable list you are using.&lt;/p&gt;
&lt;p&gt;This might be usefull when you have several GVLs. &lt;br/&gt;
When you have several GVLs and the variables also have the same name. The compiler doesn't know which GVL to use and will throw an error.&lt;/p&gt;
&lt;p&gt;A note on your long lines:&lt;br/&gt;
The STweep formatter does support automatic line breaking of long lines. The max line length can set to your own preference.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://store.codesys.com/barteling-stweep-formatter-demo.html" rel="nofollow"&gt;https://store.codesys.com/barteling-stweep-formatter-demo.html&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Global Variables</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/587bd07ae4/?limit=250#eedc/df33" rel="alternate"/><published>2020-10-22T09:42:36.997000Z</published><updated>2020-10-22T09:42:36.997000Z</updated><author><name>aliazzz</name><uri>https://forge.codesys.com/u/aliazzz/</uri></author><id>https://forge.codesys.com03fc6928a4a46aecdca34cefd888193838fb4e6e</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Removing the ~~~qualified_only~~~ pragma will not affect the code itself but how the compiler should deal with it. Pragma's are IDE or Compiler directives which tell the compiler how to deal with the code with which the pragma is decorated.&lt;/p&gt;
&lt;p&gt;For all info on using Pragma's see:&lt;br/&gt;
&lt;a href="https://help.codesys.com/api-content/2/codesys/3.5.13.0/en/_cds_using_pragmas/#id3" rel="nofollow"&gt;https://help.codesys.com/api-content/2/codesys/3.5.13.0/en/_cds_using_pragmas/#id3&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Global Variables</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/587bd07ae4/?limit=25#eedc" rel="alternate"/><published>2020-10-22T09:30:35.023000Z</published><updated>2020-10-22T09:30:35.023000Z</updated><author><name>yohay</name><uri>https://forge.codesys.com/u/yohay/</uri></author><id>https://forge.codesys.com9aec8ae77c521b4361f6d6a67e89c5af433293f4</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Forgot to ask, how dose removing qualified_only attribute efect the process?&lt;br/&gt;
It can harm the compiling or the run time of the program?&lt;br/&gt;
What is the purpose of the 'qualified_only attribute'?&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Global Variables</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/587bd07ae4/?limit=25#b437" rel="alternate"/><published>2020-10-22T09:24:29.756000Z</published><updated>2020-10-22T09:24:29.756000Z</updated><author><name>yohay</name><uri>https://forge.codesys.com/u/yohay/</uri></author><id>https://forge.codesys.com34ee159a5f1d3a5aa323d0b2e958c9ac6f0b1257</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Thank you very much!!!&lt;br/&gt;
It help a lot.&lt;br/&gt;
Hope there wont be any problems with that.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Global Variables</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/587bd07ae4/?limit=25#b93b" rel="alternate"/><published>2020-10-22T09:08:06.195000Z</published><updated>2020-10-22T09:08:06.195000Z</updated><author><name>i-campbell</name><uri>https://forge.codesys.com/u/i-campbell/</uri></author><id>https://forge.codesys.com9224450bd23eb56278065fe8117d0dab5738d522</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;When you make a GVL, it automatically adds the qualified_only attribute. (See screenshot)&lt;br/&gt;
You can remove it.&lt;br/&gt;
&lt;a href="https://help.codesys.com/webapp/_cds_pragma_attribute_qualified_only;product=codesys;version=3.5.16.0" rel="nofollow"&gt;https://help.codesys.com/webapp/_cds_pragma_attribute_qualified_only;product=codesys;version=3.5.16.0&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;alternatively, there is such products:&lt;br/&gt;
&lt;a href="https://www.lg.com/us/monitors/lg-29wn600-w-ultrawide-monitor" rel="nofollow"&gt;https://www.lg.com/us/monitors/lg-29wn600-w-ultrawide-monitor&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;you can call your GVL "g", so that it is not as long.&lt;br/&gt;
&lt;img src="./attachment/qualified_only.png" width="100%"/&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>