Can you include C ++ snippets in C #?

Is it possible to include sections of code written in Visual C ++ in my C # application, or vice versa? I know that you can do this in Objective-C, so I wanted to know if this is possible in C # (.NET 4.0).

+3
source share
3 answers

Grade. You cannot include them directly in C #, but you can use C # and C ++ / CLI together, and most C ++ can also be compiled as C ++ / CLI.

+4
source

Do you have a C ++ DLL? If so, you can call the C ++ DLL from C #. There are several questions in StackOverflow that discuss similar topics:

How to use C ++ library from C # and .NET?

DllImport , .

http://msdn.microsoft.com/en-us/library/aa288468%28VS.71%29.aspx

+2

Not directly. You can create a DLL from C ++ code and call the specified code from C #.

See: Forum topic on the relevant topic and introduction for managed C ++ . Here is also an example of mixing C ++ / C # here , although it uses the command line to generate code.

0
source

Source: https://habr.com/ru/post/1762018/


All Articles