471,603 Members | 1,431 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,603 software developers and data experts.

C#.exe "talks" to C++.exe

Hello All,
Thanks for your help first, I wonder is there any link to sample or
documentation that explain how to make .exe in C++ communicate to .exe in C#?
I know there is some way like Share Memory, COM but I really need a
place that I could get jump start
Thanks
Have a wonderful day

Anthony
Dec 11 '05 #1
2 2644
Anthony wrote:
Hello All,
Thanks for your help first, I wonder is there any link to sample or
documentation that explain how to make .exe in C++ communicate to
.exe in C#? I know there is some way like Share Memory, COM but I
really need a
place that I could get jump start


By C++ exe I assume you mean unmanaged code. If the unmanaged process is
a COM local server then it's easy, you just use tlbimp to create the
import assembly and use it in the .NET application. Of course if the
native process is not a COM server and you are not a COM developer it
might not be straightforward for you to add that functionality to your
unmanaged process.

Shared memory is another option, but there is no .NET API to do that. If
you want a clue then I recommend that you use Reflector and take a look
at how .NET handles performance monitor counters (for example, take a
look at the private type System.Diagnostics.SharedPerformanceCounter).
Note that if you have memory shared between processes then you need to
control access to it using some locking mehanism accessible to both
processes, like a couple of named events, or a named mutex.

The simplest solution is to use sockets. The native process can be a
server and the .NET process could be a socket client, and hence it would
be able to 'talk' to the native process. The internet is awash with
examples of writing socket clients and servers in .NET and with Winsock.

Richard
--
http://www.grimes.demon.co.uk/workshops/fusionWS.htm
http://www.grimes.demon.co.uk/workshops/securityWS.htm
Dec 11 '05 #2
Thanks Richard Grimes,
It's really help me for a jump start, I appeciated that
Have a great day
Anthony

"Anthony" wrote:
Hello All,
Thanks for your help first, I wonder is there any link to sample or
documentation that explain how to make .exe in C++ communicate to .exe in C#?
I know there is some way like Share Memory, COM but I really need a
place that I could get jump start
Thanks
Have a wonderful day

Anthony

Dec 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

19 posts views Thread by Jasper Dozer | last post: by
388 posts views Thread by maniac | last post: by
4 posts views Thread by Patrick | last post: by
94 posts views Thread by Samuel R. Neff | last post: by
11 posts views Thread by Robert Latest | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by CCCYYYY | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.