Surfacing a large C++ library in .net-core

Viewed 136

I have a large C++ library (1000's of objects) that I'd like to be able to access in C# on Linux.

Some background:

  • The code has 1000's of objects
  • The objects are often passed in as parameters, sometimes by reference and sometimes by a pointer
  • The code is compiled native on Linux. It is open source so I can adjust how it is built if I like, though I can't alter the C++ code.
  • I need to replicate the object code in C#
  • I've done this once on windows: I can parse and write out .cpp files that are wrappers and use the c++/cli for doing the interop. This works.

There is no reason I can't do the same process to build .netcore interop files on the Linux side. I just have no idea how to go about doing it. I've read that PInvoke is supported. Is that my only option? Turn every method call, etc., into a C-like method call?

At the moment I do not need to do the same on Windows - just on the Linux side. So any solution that is Linux only is acceptable. I've already got a Windows-only solution using .net standard.

0 Answers
Related