<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Shared Memory Access Issues</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/f9cc5cd2ee/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Runtime/thread/f9cc5cd2ee/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Runtime/thread/f9cc5cd2ee/</id><updated>2024-01-30T08:46:58.241000Z</updated><subtitle>Recent posts to Shared Memory Access Issues</subtitle><entry><title>Shared Memory Access Issues</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/f9cc5cd2ee/?limit=25#d6ff" rel="alternate"/><published>2024-01-30T08:46:58.241000Z</published><updated>2024-01-30T08:46:58.241000Z</updated><author><name>mondinmr</name><uri>https://forge.codesys.com/u/mondinmr/</uri></author><id>https://forge.codesys.com71c101ab585acdcb46f3cc6ab03452cf8c016be3</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;In Windows I need create shared memory in PC software and connect from CODESYS.&lt;br/&gt;
If shm is not GLOBAL doesn't work due different users between runtime and PC software.&lt;br/&gt;
PC software need admin privileges. Name need "Global\" before key.&lt;br/&gt;
Very unsafe!!!&lt;/p&gt;
&lt;p&gt;In Linux I can create shared memory as standard user, bind in the runtime docker, use keys without any "Global\".&lt;br/&gt;
Much more safe!!!&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Shared Memory Access Issues</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/f9cc5cd2ee/?limit=25#24c1" rel="alternate"/><published>2024-01-29T16:41:02.573000Z</published><updated>2024-01-29T16:41:02.573000Z</updated><author><name>rpostwvu</name><uri>https://forge.codesys.com/u/rpostwvu/</uri></author><id>https://forge.codesys.com1ffce9c48f591828bfbd5380dfd62962bcfdb929</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I got the shared memory example. I'm pretty sure I'm successfully created a memory space, CreateResult returns 18.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nt"&gt;szName&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="s1"&gt;'CodesysDataShare'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="nt"&gt;hShm&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;SysSharedMemoryCreate&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;szName&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;ADR&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;uxiSize&lt;/span&gt;&lt;span class="o"&gt;),&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;ADR&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;CreateResult&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;I'm trying to access this memory with a C# application, but I get "Unable to Find Specified File".   I suspect that Codesys and/or Visual Studio code alters the name I choose?  Being in Windows, I cant find a way to see the mapped memory list.&lt;br/&gt;
~~~&lt;br/&gt;
 using (var mmfRead = MemoryMappedFile.OpenExisting("CodesysDataShare",MemoryMappedFileRights.ReadWrite))&lt;br/&gt;
 ~~~&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>