C ++ Unmanaged Class in C #

Can I create an instance and β€œwork with” an unmanaged C ++ class from C # code (say, using DllImport, etc.)?

+3
source share
2 answers

On Windows, you can use COM interoperability to work with C ++. However, this will not work on Linux / Mac OS X.

Another alternative is to publish the C shell around the C ++ class (extern "C" in C ++). This is necessary because DllImport expects a C ABI.

Edit: and the third option is C ++ / CLI , i.e. compile your C ++ code for .Net. It is also a solution for Windows.

+6
source

SWIG. Mono Linux Mac.

C-, ++, #, DllImport.

++ #, ++- , #.

0

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


All Articles