Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 9
    P/Invoke can be used IFF you create an 'extern C' wrapper around the C++, either way you need a wrapper somewhere Commented Mar 9, 2020 at 8:09
  • 11
    In my experience, using P/Invoke is a real pain when it comes to memory handling, and is not well suited at all to an object-oriented style. C++/CLI has a slightly weird syntax, but works fairly well once you're used to it. Commented Mar 9, 2020 at 12:30
  • 5
    You can PInvoke non-extern methods, but name mangling makes it a somewhat miserable experience. Commented Mar 9, 2020 at 22:30
  • 1
    Just as a note - C++/CLI support is not quite there yet for Linux, though Microsoft is working on the problem for .NET Core 3.1: devblogs.microsoft.com/cppblog/… Commented Mar 10, 2020 at 18:24