Sign in to follow this  

Share Data between C++ and C# Processes

This topic is 3775 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi All, I have a C# Windows Application that is implemented in MS C# 2005, it launches a C++ Console Application that is implemented in MS Visual Studio 6 as a separate process. At run time, I need to have both applications communicate with each other. Basically, both applications need to keep updating the values of 6 common variables. What is the best way to implement this? Please provide links to good examples if possible. Thanks in advance.

Share this post


Link to post
Share on other sites
The following are solutions that are available under *nix systems, though I am sure they either exist under Windows or have Windows equivalents:

-Use the shmget() system call to establish a shared piece of memory between separate processes. This system call is likely to exist under windows.

-Use a 'Unix' socket to talk between processes. A 'Unix' socked is just like a tcp/ip socket except it is used for communication on the local machine. This is available if you have access to a Berkley sockets implementation, check winsock (Windows Sockets) for a similar feature.

-The last and probably most elaborate idea is to use a database to share the data between the applications ... which I imagine is too much for your needs.

[Edited by - fpsgamer on August 10, 2007 10:00:01 PM]

Share this post


Link to post
Share on other sites
I just remembered another method, and that is to use a Pipe.

However after some thought, considering one application is in C# and one in C++, using winsock to connect the apps is probably best.

Share this post


Link to post
Share on other sites

This topic is 3775 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this