Communication between C ++ and C #?

I want to use both C ++ and C # in my application.

C # for GUI design and C ++ for processing.

But I don't know about that. How to communicate between them.

I don't know where I should start and research.

Can anyone please tell me about this technology? And if anyone has a document on this topic, please give it to me.

I am using Visual Studio 2010 for development.

Many thanks,

T & TGroup

+3


source to share


4 answers


The technology you are looking for is C ++ / CLI , a native language extension for C ++ that allows you to interact with .Net code.



The basic idea is this: you write your C ++ libraries, as always, in portable ISO C ++. Then you add a thin wrapper to C ++ / CLI for whatever C ++ components you want to call from C # (or any other .Net language for that matter). Just keep in mind that C ++ / CLI is only for writing code to interact with .Net. Don't be tempted to write the implementation in the CLI, as you will end up with code that is not portable and is probably much harder to maintain than the pure C ++ version.

+4


source


Depending on how your application architecture needs to be, you can, for example, create two different applications, one being the core and the other being the GUI and communicate via messaging.



On Windows, you can use Windows message queue , for example, to have both endpoints communicate with each other.

+2


source


You can use C ++ CLI or native C ++. C ++ CLI is managed code and native C ++ would be unmanaged CLR. The choice between them depends on your use. There are certain limitations in the C ++ CLI.

+1


source


It totally depends on architecture and requirements. You can write processing instructions in C ++ (lib) using them in a GUI. Also can be done easily in VS 2010

+1


source







All Articles