Unagi
Unagi

Reputation: 105

writing C# API as a wrapper of C++ code?

I am Window application developer. I have a C++ library and want to write C# API for this C++ library. I guess I can write COM library by wrapper around this C++ library. But I am not sure if COM library is a language independence. I also heard that .NET framework provide a language independence environment by re-compiling my library to an intermediate code. But I am not quite sure how to do it in .NET.

Since I am quite new in this area, please advice me any resource or technology that I can take a look. Thank you!

Upvotes: 0

Views: 372

Answers (1)

Nadir Muzaffar
Nadir Muzaffar

Reputation: 4842

COM is exactly for language independence. It's main intent is seperation of interface from implementation. You will very likely have to write a COM interface to wrap the C++ library which can then be consumed by C#.

But COM is also a fairly complex as a concept to understand and then properly use. Depending on the size of the library, it might even be faster to rewrite the C++ library as a C# library, then to learn COM and then expose the C++ library through it.

Upvotes: 1

Related Questions