Home > Articles > Programming > C#

  • Print
  • + Share This
Like this article? We recommend

Like this article? We recommend

Other Reasons for Calling C++ Code from C#

Beyond the need to bridge legacy C++ code into the .NET/C# domain, there are other reasons for trying to access code written in C or C++:

  • One obvious example is performance. A specific block of C/C++ code may simply be faster than comparable C# code. This is reminiscent of the old arguments about Java and C++.
  • In certain situations, there may be a strong case for needing direct access to memory outside the management of the .NET Common Language Runtime.
  • Another time you may need pointers is when you have to call in to DLLs that contain C-based functions. The same may be true for COM server code.

One final point with regard to legacy languages concerns embedded devices. Increasingly, C++ is the language of choice for these platforms. If you want to bridge between such devices and the C# world, you now have a few tools for making a start.

  • + Share This
  • 🔖 Save To Your Account