1

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 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.