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?
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.