Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ program output data to C#

Tags:

c++

c#

Is there any simple way to get a few data variables from a C++ program into C#? Both programs would run on the same computer.

I need this to communicate the results of a C++ coded program (position: x,y (integer) and orientation (double)) to another device using C# coded sdk...

I am thinking along the lines of allocating a memory region then declaring it in a file, reading the file in C# to get the pointers and then working from there using a semaphore to control access.

Would this work? Any references on how to write something like that in both C# and C++?

All help is much appreciated!

like image 461
Laov Avatar asked May 17 '26 10:05

Laov


1 Answers

Sure! The one example is shared memory: Sharing variables between C# and C++ (that is what you mean with allocate memory and so on)

The second one is the "named pipes" method: http://www.codeproject.com/Tips/420582/Inter-Process-Communication-between-Csharp-and-Cpl

like image 97
Leo Chapiro Avatar answered May 19 '26 23:05

Leo Chapiro