1

Ok so the scenario is as followed.

Application1 has the ability to load and make calls to an unmanaged C++ DLL.

I want to write another user interface in C# to make my life easier.

I then want the DLL to be able to send information to the C# executable, and the C# executable to be able to send information to the DLL.

The information being passed back and forth is not complex. It will simply be a string.

Any ideas on how this can be done.

CathalMF
  • 9,705
  • 6
  • 70
  • 106
  • what have you tried / did you search on this site already? I'm pretty sure that this has been covered by existing questions. – TooTone Nov 28 '13 at 17:42
  • 1
    A DLL doesn't normally have a life of its own, like a process does. You have to make a call to an exported function to get it to do something. Or make it return something. Just arguments and function return values. – Hans Passant Nov 28 '13 at 18:53

1 Answers1

1

This should answer your question. Basically the easiest options are Named Pipes for communication on the same machine, and Sockets for different machines.
Update
After better consideration, the answer depends on 'Who is in control?' in your scenario.
1. If C# executable is responsible for calling your unmanaged DLL and sending/retrieving information, then you should go with Platform Invoke.
2. If you you want your unmanaged DLL to decide when to send data to the application, then first of all you should transform your DLL into full fledged application and after that go with the interprocess communication.

Community
  • 1
  • 1
Yurii
  • 4,811
  • 7
  • 32
  • 41
  • Are you sure about this answer? Pipes and sockets are for interprocess communication. The OP is doing in-process communication. – TooTone Nov 28 '13 at 21:19
  • @TooTone, I suppose I didn't fully understand the question, so I updated the answer, thanks for the tip. – Yurii Nov 29 '13 at 16:36