Call C++ library in C# [closed]
I have a lot of libraries written in C++. I want to call these libraries from C#, however, I have met many problems. I want to know if there is a book or guideline to tell me how to do that.
Solution 1:
- DllImport - http://msdn.microsoft.com/en-us/library/aa984739(VS.71).aspx
- Wrapper class - http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/67cc9eea-a4fe-48bd-b8d5-f3c8051ba896
Solution 2:
If you google "c++ c# interop", you'll find tons of information on this topic.
A couple of links:
http://msdn.microsoft.com/en-us/magazine/cc301501.aspx
http://msdn.microsoft.com/en-us/library/ms235281(VS.80).aspx
Solution 3:
I recently had to wrap some c++ code in .NET. Although the c++ code was packaged as a dll, the interface was too unfriendly for P/Invoke, so I decided to write it in managed c++, or C++/CLI as it is apparently known now.
I found this tutorial very useful on the syntax. It's not so easy on the eye, but the content seemed pretty good.