Gokul Kumar
Gokul Kumar

Reputation: 409

How to send data from c++ application to dot net core app using Named pipeline

I have a dot net core application and I have to get the response from the C++ application. Also send the response back to C++ also.

In simple terms,

C++ -> C#

C# -> C++

I have gone through many links and got to know we can use DllImport in the C# application to access the Cpp methods. But DllImport and Named Pipeline are both the same or different?

If it is different, I want to access the C++ methods in the CSharp application using the Named pipeline.

Please suggest any links and clarify my doubts.

Thanks!

Upvotes: 0

Views: 202

Answers (1)

Tohnmeister
Tohnmeister

Reputation: 534

DllImport and named pipelines are completely different things. You could indeed use DllImport and declare static extern functions that match the signature of your (exported) C++ functions and call them from your C# application. See: https://learn.microsoft.com/en-us/dotnet/standard/native-interop/pinvoke

Named pipelines are for sending data from one application (or module) to another, where you would have to do the serialization and deserialization and/or mapping to functions yourself.

If you just want to call C++ code from C# code, DllImport is the way to go.

Upvotes: 1

Related Questions