How can I import a class from a C++ unmanaged project and use it in a C# class library? The solutions I have seen worked in execute projects. Are there any step by step guides?
1 Answer
A native C++ class can't be directly consumed from C#/.NET code.
You can wrap the native C++ class using a tiny C++/CLI interop layer, and then use that from C#.
Or you could build a COM wrapper around the native C++ class, and consume the COM component from C#.
Another option would be to build a DLL with a pure C interface, wrapping the native C++ class, and then consume that C-interface DLL from C# using P/Invoke.