×
Get in touch

Get in touch with Binary

Binary Studio website uses cookies to enhance your browsing experience. By continuing to use our site, you agree to our Privacy Policy and use of cookies.

Learn more more arrow
Agree
Binary Studio 17.11.2011

.NET Team Meeting. 11/17/2011


Today's topic was dedicated to interopability between unmanaged C++ and managed C# sides. The speaker Denis P. proposed three concepts to reach the stated goal:

  • C++/CLI language extensions as the most smooth approach. It enables a programmer to construct absolutely naturally-looking .NET classes with event sourcing, static members and properties in a convenient way.
  • C# PInvoke - can be applied to simple tasks of invoking unmanaged static library methods. More complex classes require more coding (especially creating events, since PInvoke restricts unmanaged callbacks only to call delegates from managed code). Working with .NET types from unmanaged level is also obscured.
  • COM Interop - smooth for programmers familiar with COM technology, allows to receive proper .NET classes with events but without static methods (COM architecture limitation). Creating .NET classes from COM level also possible but requires additional work.

Conclusion: for a simple interoperation it's better to use PInvoke, for some complex cases - C++/CLI language. COM is in the middle of these sides, but complex for the first try.