Passing data between C++ (MFC) app and C#

前端 未结 9 1334
一向
一向 2020-12-31 17:45

We have a monolithic MFC GUI app that is nearing the end of it\'s life in C++. We are planning to build new functionality in C# and pass data between each app.

Quest

9条回答
  •  一整个雨季
    2020-12-31 18:35

    Take your pick:

    • files
    • named pipes <-- My recommendation
    • shared memory
    • sockets
    • COM
    • Windows messages

    Why named pipes?

    • Gives you a FIFO way of working for free (like sockets, but not like shared memory)
    • Can easily communicate both ways
    • Well supported on all platforms
    • Easy to use
    • Reliable data passing and delivery
    • Can be blocking and non blocking
    • Can read data without removing (unlike sockets)
    • Can be expanded to include a third app easily.

    In .Net just use System.IO.Pipes.

    In C++ use CreateNamedPipe and CreateFile.

提交回复
热议问题