How to create Shared memory between C# application and VC++ console application
-
I want to create shared memory in a C# windows application. And a second console application in visual studio has to share the same memory using OpenFileMapping function. Is it possible to share memory as I mentioned between one application in C# and other application in Visual C++ console application. Please advise and suggest the ways of doing this
-
I want to create shared memory in a C# windows application. And a second console application in visual studio has to share the same memory using OpenFileMapping function. Is it possible to share memory as I mentioned between one application in C# and other application in Visual C++ console application. Please advise and suggest the ways of doing this
The BCL has plenty of support for memory-mapped files: Memory-Mapped Files | Microsoft Docs[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
I want to create shared memory in a C# windows application. And a second console application in visual studio has to share the same memory using OpenFileMapping function. Is it possible to share memory as I mentioned between one application in C# and other application in Visual C++ console application. Please advise and suggest the ways of doing this
I would strongly suggest that you don't: instead redesign to use message based communications via Named Pipes[^] or Sockets C#[^] / Sockets C++[^] It's a much more robust solution that can be a whole load more flexible.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!
-
I want to create shared memory in a C# windows application. And a second console application in visual studio has to share the same memory using OpenFileMapping function. Is it possible to share memory as I mentioned between one application in C# and other application in Visual C++ console application. Please advise and suggest the ways of doing this
Going in circles. [Shared memory - C# Discussion Boards](https://www.codeproject.com/Messages/5813583/Shared-memory)
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food
-
Going in circles. [Shared memory - C# Discussion Boards](https://www.codeproject.com/Messages/5813583/Shared-memory)
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food
But I didnt get a solution. Please provide me some details and hints how to share memory between C# application and VC++ console application
-
The BCL has plenty of support for memory-mapped files: Memory-Mapped Files | Microsoft Docs[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
This gives details for creating and opening shared memory between 2 C# application processes. Please help me to share memory between 2 applications, one in C# and other VC++ console application to open the share memory created in C# application. Is it possible of doing this? Please advise
-
This gives details for creating and opening shared memory between 2 C# application processes. Please help me to share memory between 2 applications, one in C# and other VC++ console application to open the share memory created in C# application. Is it possible of doing this? Please advise
The documentation tells you how to create or access memory-mapped files from a C# application. You presumably already know how to create or access memory-mapped files from a C++ application. If not, the Microsoft docs site has details: Memory-Mapped File Information - Win32 apps | Microsoft Docs[^] The file doesn't care which language was used to create the process that's accessing it.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
But I didnt get a solution. Please provide me some details and hints how to share memory between C# application and VC++ console application
-
I want to create shared memory in a C# windows application. And a second console application in visual studio has to share the same memory using OpenFileMapping function. Is it possible to share memory as I mentioned between one application in C# and other application in Visual C++ console application. Please advise and suggest the ways of doing this
If helps. A memory mapped file is an OS supported option. C++ can use and access a memory mapped file. C# can use and access a memory mapped file. So the solution is 1. Study memory mapped files so you specifically understand how they can be shared between applications. I believe sharing requires a specific set up. 2. Study the api for C++ memory mapped files. 3. Study the api for C# memory mapped files. 4. Design how the memory mapped file will be used. Pay attention to failure scenarios. 5. Use 2 and 4 to implement a solution in the C++ app. 6. Use 3 and 4 to implement a solution in the C# app.